diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2022-02-08 18:35:22 +0300 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2022-02-08 18:35:29 +0300 |
commit | ae9414d5621f6de5060007ee12c3face233a98c1 (patch) | |
tree | 31df8e3e7e85a204112437b5d0acd9c2d8e269bf /llvm/lib/Analysis/ValueTracking.cpp | |
parent | eaac0e87fb0249f9b87b9929b1afa24504db9792 (diff) | |
download | llvm-ae9414d5621f6de5060007ee12c3face233a98c1.zip llvm-ae9414d5621f6de5060007ee12c3face233a98c1.tar.gz llvm-ae9414d5621f6de5060007ee12c3face233a98c1.tar.bz2 |
[ValueTracking] Only check for non-undef/poison if already known to be a self-multiply
https://godbolt.org/z/js9fTTG9h
^ we don't care what `isGuaranteedNotToBeUndefOrPoison()` says
unless we already knew that the operands were equal.
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 9fe538d..236db5e 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -453,8 +453,9 @@ static void computeKnownBitsMul(const Value *Op0, const Value *Op1, bool NSW, bool SelfMultiply = Op0 == Op1; // TODO: SelfMultiply can be poison, but not undef. - SelfMultiply &= - isGuaranteedNotToBeUndefOrPoison(Op0, Q.AC, Q.CxtI, Q.DT, Depth + 1); + if (SelfMultiply) + SelfMultiply &= + isGuaranteedNotToBeUndefOrPoison(Op0, Q.AC, Q.CxtI, Q.DT, Depth + 1); Known = KnownBits::mul(Known, Known2, SelfMultiply); // Only make use of no-wrap flags if we failed to compute the sign bit |