[llvm] d9c2695 - [VPlan] Remove manual constant fold in VPWidenIntOrFpInductionRecipe. NFC (#118028)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 28 15:21:57 PST 2024


Author: Luke Lau
Date: 2024-11-29T00:21:53+01:00
New Revision: d9c269577e6e68e1336461f266b20780f4d78dba

URL: https://github.com/llvm/llvm-project/commit/d9c269577e6e68e1336461f266b20780f4d78dba
DIFF: https://github.com/llvm/llvm-project/commit/d9c269577e6e68e1336461f266b20780f4d78dba.diff

LOG: [VPlan] Remove manual constant fold in VPWidenIntOrFpInductionRecipe. NFC (#118028)

This manual constant folding was added in 2017 in
https://reviews.llvm.org/D29956, but since then it looks like IRBuilder
has learnt to fold it away itself.
I'm not sure at what point this happened, I just verified this by
stepping through the call to CreateVectorSplat in the debugger.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 3b11ec77813f3e..8a44b5b176c46d 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -1702,13 +1702,7 @@ void VPWidenIntOrFpInductionRecipe::execute(VPTransformState &State) {
     Value *Mul = Builder.CreateBinOp(MulOp, Step, RuntimeVF);
 
     // Create a vector splat to use in the induction update.
-    //
-    // FIXME: If the step is non-constant, we create the vector splat with
-    //        IRBuilder. IRBuilder can constant-fold the multiply, but it
-    //        doesn't handle a constant vector splat.
-    SplatVF = isa<Constant>(Mul)
-                  ? ConstantVector::getSplat(State.VF, cast<Constant>(Mul))
-                  : Builder.CreateVectorSplat(State.VF, Mul);
+    SplatVF = Builder.CreateVectorSplat(State.VF, Mul);
   }
 
   Builder.restoreIP(CurrIP);


        


More information about the llvm-commits mailing list