[PATCH] D16240: [InstCombine] Simplify a known nonzero incoming value of PHI

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 18 11:22:57 PST 2016


sanjoy added inline comments.

================
Comment at: lib/Transforms/InstCombine/InstCombinePHI.cpp:940
@@ +939,3 @@
+        Value *VA = PN.getIncomingValue(i);
+        if (!isa<ConstantInt>(VA) && VA->hasOneUse() &&
+            isKnownNonZero(VA, DL, 0, AC, &PN, DT))
----------------
Why do you care about `VA` having only one use?

================
Comment at: lib/Transforms/InstCombine/InstCombinePHI.cpp:941
@@ +940,3 @@
+        if (!isa<ConstantInt>(VA) && VA->hasOneUse() &&
+            isKnownNonZero(VA, DL, 0, AC, &PN, DT))
+          PN.setIncomingValue(i, ConstantInt::get(PN.getType(), 1));
----------------
Can't `CtxI` be the terminator of the `i` th incoming block?


http://reviews.llvm.org/D16240





More information about the llvm-commits mailing list