[llvm] [LV] Fix unsafe canVectorizeWithIfConvert() checks (PR #203273)
Graham Hunter via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 12 06:51:01 PDT 2026
================
@@ -2962,7 +2962,10 @@ bool LoopAccessInfo::blockNeedsPredication(const BasicBlock *BB,
assert(TheLoop->contains(BB) && "Unknown block used");
// Blocks that do not dominate the latch need predication.
+ // Treat blocks in loops with no unique latch as always needing predication.
const BasicBlock *Latch = TheLoop->getLoopLatch();
+ if (!Latch)
----------------
huntergr-arm wrote:
We normally wouldn't hit this, as loops with multiple latches/backedges would be excluded before we got this far.
But with `DoExtraAnalysis` enabled in LoopVectorizationLegality, we proceed with checks after any failures to see if there are additional reasons for not vectorizing. Unfortunately, some of the later checks assume they don't have to deal with certain IR and crash as a result. We could make `DoExtraAnalysis` an explicit opt-in instead of enabling alongside pass remarks to be safer.
https://github.com/llvm/llvm-project/pull/203273
More information about the llvm-commits
mailing list