[PATCH] D12383: Teach LVI to look through Phi nodes when trying to prove a predicate

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 16:07:26 PDT 2015


sanjoy added a comment.

This change looks fine to me (minor comments inline); but I'll wait for someone more familiar with this area to take a look.


================
Comment at: lib/Analysis/LazyValueInfo.cpp:1288
@@ +1287,3 @@
+        Tristate Baseline = Unknown;
+        for (unsigned i = 0; i < PHI->getNumIncomingValues(); i++) {
+          Value *Incoming = PHI->getIncomingValue(i);
----------------
LLVM style says `i = 0, e = getNumIncomingValues(); i != e; i++`.

================
Comment at: lib/Analysis/LazyValueInfo.cpp:1300
@@ +1299,3 @@
+          };
+          Baseline = (Baseline == Unknown) ? Result /* First iteration */
+            : mergeResults(Baseline, Result); /* All others */
----------------
I'd check for "first iteration" using `i == 0` instead.


http://reviews.llvm.org/D12383





More information about the llvm-commits mailing list