[llvm] [VPlan] Add VPlan-based addMinIterCheck, replace ILV for non-epilogue. (PR #153643)

via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 23 05:32:18 PDT 2025


================
@@ -7327,6 +7257,17 @@ DenseMap<const SCEV *, Value *> LoopVectorizationPlanner::executePlan(
       BestVPlan.resetTripCount(Exp);
     ExpSCEV->eraseFromParent();
   }
+  // SCEV expansion will add new instructions in the IRBB wrapped by Entry.
+  // Remove existing VPIRInstructions/VPIRPhi and re-create them to make sure
+  // all IR instructions are wrapped. Otherwise VPInstructions may be inserted
+  // at the wrong place.
----------------
ayalz wrote:

> I think handling expanding VPExpandSCEV recipes early and making them abstract recipes would be cleaner. As I first step, I just moved expansion in 300d2c6d2037eb5ea751bd0451d8adc2a1bd5c5d.
> 
> 
> 

Better have the code expanded at the position of its ExpandSCEV recipe, as done originally considering insertion point of builder, than at the end of the Entry block?

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


More information about the llvm-commits mailing list