[llvm] [LV] Fix unsafe canVectorizeWithIfConvert() checks (PR #203273)
Gaƫtan Bossu via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 12 09:09:25 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)
----------------
gbossu wrote:
I chose `return true` as the conservative value given how `blockNeedsPredication` is used in LV.
If you prefer, I could maybe fix the callsites instead and make `TheLoop->getLoopLatch() != nullptr` a precondition for `blockNeedsPredication`.
https://github.com/llvm/llvm-project/pull/203273
More information about the llvm-commits
mailing list