[PATCH] D101273: [LazyValueInfo] Insert an Overdefined placeholder to prevent infinite recursion

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 28 00:56:30 PDT 2021


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/LazyValueInfo.cpp:1173
   if (L == Cond || R == Cond)
     return ValueLatticeElement::getOverdefined();
 
----------------
It should be possible to drop this code now.


================
Comment at: llvm/lib/Analysis/LazyValueInfo.cpp:1198
+  // Insert an Overdefined placeholder into the set to prevent
+  // infinite recursion if there exists invalid IRs that use not
+  // dominated by its def as in this example:
----------------
It's not really invalid IR...


================
Comment at: llvm/lib/Analysis/LazyValueInfo.cpp:1202
+  //   "%tmp4 = or i1 undef, %tmp3"
+  Visited[Cond] = ValueLatticeElement::getOverdefined();
 
----------------
You are performing two successive DenseMap accesses here. Instead you can use `Visited.try_emplace(Cond, ValueLatticeElement::getOverdefined())` which check `.second` for whether it's a pre-existing cache entry.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101273/new/

https://reviews.llvm.org/D101273



More information about the llvm-commits mailing list