[llvm] [HashRecognize] Forbid optz when data.next has exit-block user (PR #165574)

Piotr Fusik via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 29 09:55:22 PDT 2025


================
@@ -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)
----------------
pfusik wrote:

`SimpleRecurrence.BO` might be null.

https://github.com/llvm/llvm-project/pull/165574


More information about the llvm-commits mailing list