aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2022-02-08 18:35:22 +0300
committerRoman Lebedev <lebedev.ri@gmail.com>2022-02-08 18:35:29 +0300
commitae9414d5621f6de5060007ee12c3face233a98c1 (patch)
tree31df8e3e7e85a204112437b5d0acd9c2d8e269bf /llvm/lib/Analysis/ValueTracking.cpp
parenteaac0e87fb0249f9b87b9929b1afa24504db9792 (diff)
downloadllvm-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.cpp5
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