[llvm] [LoopVectorize] Enable vectorisation of early exit loops with live-outs (PR #120567)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 7 02:58:57 PST 2025


================
@@ -2985,6 +3094,23 @@ void InnerLoopVectorizer::fixVectorizedLoop(VPTransformState &State) {
   PSE.getSE()->forgetLoop(OrigLoop);
   PSE.getSE()->forgetBlockAndLoopDispositions();
 
+  // When dealing with uncountable early exits we create a vector.early.exit
+  // block predecessor of the exit block. This block needs to have the same
+  // parent loop as the exit block itself.
+  VPRegionBlock *VectorRegion = State.Plan->getVectorLoopRegion();
+  if (BasicBlock *OrigEarlyExitBB = Legal->getUncountableEarlyExitBlock()) {
----------------
david-arm wrote:

I had to fix a bug in `VPBasicBlock::execute` that incorrectly adds some VPBasicBlocks to the wrong parent loop.

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


More information about the llvm-commits mailing list