[llvm] [HashRecognize] Fix compiler crash on missing latch compare instruction (PR #211895)
Sean Clarke via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 27 07:20:21 PDT 2026
================
@@ -512,7 +512,8 @@ std::variant<PolynomialInfo, StringRef> HashRecognize::recognizeCRC() const {
BasicBlock *Latch = L.getLoopLatch();
BasicBlock *Exit = L.getExitBlock();
const PHINode *IndVar = L.getCanonicalInductionVariable();
- if (!Latch || !Exit || !IndVar || L.getNumBlocks() != 1)
+ if (!Latch || !Exit || !IndVar || L.getNumBlocks() != 1 ||
+ !L.getLatchCmpInst())
----------------
xarkenz wrote:
I'm not convinced it does:
```cpp
/// Return true if the loop induction variable starts at zero and increments
/// by one each time through the loop.
bool isCanonical(ScalarEvolution &SE) const;
```
It might be better to just keep the individual checks for clarity, unless there's some function that clearly covers all of these.
https://github.com/llvm/llvm-project/pull/211895
More information about the llvm-commits
mailing list