[llvm] [LV] Fix unsafe canVectorizeWithIfConvert() checks (PR #203273)

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 12 07:14:14 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:

I guess one alternative is to return true if a block doesn't dominate all latches? I don't have a motivating example for that though -- many loops with >1 latch from the original source end up being converted to a single latch loop and just branch over all the blocks that would be skipped by a 'continue' or similar.

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


More information about the llvm-commits mailing list