[PATCH] D16240: [InstCombine] Simplify a known nonzero incoming value of PHI
Matthew Simpson via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 18 13:31:23 PST 2016
mssimpso 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))
----------------
junbuml wrote:
> sanjoy wrote:
> > Why do you care about `VA` having only one use?
> In correctness perspective, we don't have to check VA->hasOneUse(), but I expected the real impact on performance only when the incoming value become a dead code from this modification. I'm okay with removing this check (VA->hasOneUse()) if we can expect any indirect benefit.
I think keeping the one-use check makes sense. If we only expect there to be a benefit if VA becomes dead, we want to avoid increasing compile-time. The only corner case that I can think of is if all of VAs users are PHIs that are compared with zero.
http://reviews.llvm.org/D16240
More information about the llvm-commits
mailing list