[llvm] [ValueTracking] Handle FADD and XOR in matchSimpleRecurrence. (PR #144031)

Ricardo Jesus via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 13 02:27:08 PDT 2025


rj-jesus wrote:

Thanks, that makes sense to me. Removing the whitelist leads to an ICE on:
```
LLVM :: Analysis/HashRecognize/cyclic-redundancy-check.ll
```
Presumably due to an unhandled opcode in `llvm/lib/Analysis/HashRecognize.cpp` (FDIV it seems).

This seems to sort it:
```
diff --git a/llvm/lib/Analysis/HashRecognize.cpp b/llvm/lib/Analysis/HashRecognize.cpp
index b245548dea6d..cf172f6871cf 100644
--- a/llvm/lib/Analysis/HashRecognize.cpp
+++ b/llvm/lib/Analysis/HashRecognize.cpp
@@ -580,6 +580,8 @@ HashRecognize::recognizeCRC() const {
   if (!ByteOrderSwapped)
     return "Loop with non-unit bitshifts";
   if (SimpleRecurrence) {
+    if (!SE.isSCEVable(SimpleRecurrence.BO->getType()))
+      return "Type is not SCEVable";
     if (isBigEndianBitShift(SE.getSCEV(SimpleRecurrence.BO)) !=
         ByteOrderSwapped)
       return "Loop with non-unit bitshifts";
```
Does that look like a reasonable change?
CC @artagnon 

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


More information about the llvm-commits mailing list