From 75be1a9e5821c39f09666ef83812dbb9d0e75189 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Fri, 16 Aug 2019 09:15:02 +0000 Subject: [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 --- llvm/lib/Analysis/ValueTracking.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Analysis/ValueTracking.cpp') 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); -- cgit v1.2.3