[llvm] [VPlan] Add VPValue for VF, use it for VPWidenIntOrFpInductionRecipe. (PR #95305)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 8 16:31:38 PDT 2024


================
@@ -928,8 +928,19 @@ void VPlan::prepareToExecute(Value *TripCountV, Value *VectorTripCountV,
 
   IRBuilder<> Builder(State.CFG.PrevBB->getTerminator());
   // FIXME: Model VF * UF computation completely in VPlan.
-  VFxUF.setUnderlyingValue(
-      createStepForVF(Builder, TripCountV->getType(), State.VF, State.UF));
+  Value *RuntimeVF = nullptr;
+  if (VF.getNumUsers()) {
+    RuntimeVF = createStepForVF(Builder, TripCountV->getType(), State.VF, 1);
----------------
ayalz wrote:

>> could setting VF and/or VFxUF be done by optimizeForVFAndUF() instead, i.e., as soon as they are fixed for a VPlan?

> Could do, but may not be ideal to rely on an optimization to set them?

How about renaming the `optimizeForVFAndUF()` VPlanTransform to `setVFAndUF()`, or `setVF()` and `setUF()` VPlanTransforms, where fixing a constant value triggers its folding optimizations?

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


More information about the llvm-commits mailing list