aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/HashRecognize.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/HashRecognize.cpp')
-rw-r--r--llvm/lib/Analysis/HashRecognize.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/HashRecognize.cpp b/llvm/lib/Analysis/HashRecognize.cpp
index 4529123..8974ce5 100644
--- a/llvm/lib/Analysis/HashRecognize.cpp
+++ b/llvm/lib/Analysis/HashRecognize.cpp
@@ -468,8 +468,11 @@ std::variant<PolynomialInfo, StringRef> HashRecognize::recognizeCRC() const {
// Ensure that the PHIs have exactly two uses:
// the bit-shift, and the XOR (or a cast feeding into the XOR).
+ // Also ensure that the SimpleRecurrence's evolution doesn't have stray
+ // users.
if (!ConditionalRecurrence.Phi->hasNUses(2) ||
- !SimpleRecurrence.Phi->hasNUses(2))
+ !SimpleRecurrence.Phi->hasNUses(2) ||
+ SimpleRecurrence.BO->getUniqueUndroppableUser() != SimpleRecurrence.Phi)
return "Recurrences have stray uses";
// Check that the SelectInst ConditionalRecurrence.Step is conditional on