[llvm] [HashRecognize] Track visited in ValueEvolution (PR #147812)

Piotr Fusik via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 01:42:30 PDT 2025


================
@@ -634,6 +649,19 @@ HashRecognize::recognizeCRC() const {
     return VE.getError();
   KnownBits ResultBits = VE.KnownPhis.at(ConditionalRecurrence.Phi);
 
+  // There must be exactly four unvisited instructions, corresponding to the
+  // IndVar PHI:
+  //   IndVar
+  //   Latch->getTerminator()
+  //   L.getLatchCmpInst(),
+  //   IndVar->getIncomingValueForBlock(Latch))
+  //
+  // Any other unvisited instructions from the KnownBits propagation can
+  // complicate the optimization, which would just replace the entire loop with
----------------
pfusik wrote:

```suggestion
  // complicate the optimization, which replaces the entire loop with
```
Otherwise it looked like the replacement was for the unvisited instructions scenario.

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


More information about the llvm-commits mailing list