[llvm] [VPlan] Remove manual constant fold in VPWidenIntOrFpInductionRecipe. NFC (PR #118028)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 28 10:18:22 PST 2024
https://github.com/lukel97 created https://github.com/llvm/llvm-project/pull/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.
>From 2790abfab8d8e51969c75fb2a3d5628b640dddd4 Mon Sep 17 00:00:00 2001
From: Luke Lau <luke at igalia.com>
Date: Thu, 28 Nov 2024 19:15:01 +0100
Subject: [PATCH] [VPlan] Remove manual constant fold in
VPWidenIntOrFpInductionRecipe. NFC
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.
---
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 24cf4666c62ce3..7bdf50fc6a9686 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -1691,13 +1691,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