summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2019-08-16 09:15:02 +0000
committerFlorian Hahn <flo@fhahn.com>2019-08-16 09:15:02 +0000
commit75be1a9e5821c39f09666ef83812dbb9d0e75189 (patch)
tree710beb43791eb97a0fa253556920ef61b263b1cd /llvm/lib/Analysis/ValueTracking.cpp
parent120cffccf8c3a46f6003a3b5a6b0f39130df4bd2 (diff)
downloadbcm5719-llvm-75be1a9e5821c39f09666ef83812dbb9d0e75189.tar.gz
bcm5719-llvm-75be1a9e5821c39f09666ef83812dbb9d0e75189.zip
[ValueTracking] Fix recurrence detection to check both PHI operands.
Summary: Currently we fail to compute known bits for recurrences where the first incoming value is the start value of the recurrence. Instead of exiting the loop when the first incoming value is not the step of the recurrence, continue to check the second incoming value. The original code uses a loop to handle both cases, but incorrectly exits instead of continuing. Reviewers: lebedev.ri, spatel, nikic Reviewed By: lebedev.ri Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66216 llvm-svn: 369088
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 8027c2706ee..127c3dcc35c 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -1373,7 +1373,7 @@ static void computeKnownBitsFromOperator(const Operator *I, KnownBits &Known,
else if (LR == I)
L = LL;
else
- break;
+ continue; // Check for recurrence with L and R flipped.
// Ok, we have a PHI of the form L op= R. Check for low
// zero bits.
computeKnownBits(R, Known2, Depth + 1, Q);
OpenPOWER on IntegriCloud