[llvm] [LV] Transform to handle exits in the scalar loop (PR #148626)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 12 06:36:55 PST 2025


================
@@ -3218,7 +3220,11 @@ expandVPWidenIntOrFpInduction(VPWidenIntOrFpInductionRecipe *WidenIVR,
   }
 
   // If the phi is truncated, truncate the start and step values.
-  VPBuilder Builder(Plan->getVectorPreheader());
+  VPBasicBlock *VectorPH = Plan->getVectorPreheader();
+  VPBuilder Builder(VectorPH);
+  if (VPRecipeBase *Br = VectorPH->getTerminator())
+    Builder.setInsertPoint(Br);
----------------
MacDue wrote:

What's the point of this change? `VPBuilder Builder(VectorPH);` already sets the insert point to the end of the block. No tests fail if this is reverted. 

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


More information about the llvm-commits mailing list