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

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 21:04:43 PST 2016


hfinkel added a subscriber: hfinkel.

================
Comment at: lib/Transforms/InstCombine/InstCombinePHI.cpp:941
@@ +940,3 @@
+        Value *VA = PN.getIncomingValue(i);
+        if (!isa<ConstantInt>(VA) && isKnownNonZero(VA, DL, 0, AC, CtxI, DT))
+          PN.setIncomingValue(i, ConstantInt::get(PN.getType(), 1));
----------------
You skip constants, why? And if there is a constant (aside from zero), should we not reuse it instead of creating a new one (1 in this case). We might end up materializing more constants this way.


http://reviews.llvm.org/D16240





More information about the llvm-commits mailing list