[llvm] [LV][NFC] Remove unnecessary multiply in expandVPWidenIntOrFpInduction (PR #170159)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 1 08:26:23 PST 2025
================
@@ -3454,9 +3454,11 @@ expandVPWidenIntOrFpInduction(VPWidenIntOrFpInductionRecipe *WidenIVR,
Init = Builder.createWidenCast(Instruction::UIToFP, Init, StepTy);
VPValue *SplatStart = Builder.createNaryOp(VPInstruction::Broadcast, Start);
- VPValue *SplatStep = Builder.createNaryOp(VPInstruction::Broadcast, Step);
- Init = Builder.createNaryOp(MulOp, {Init, SplatStep}, Flags);
+ if (!match(Step, m_One())) {
+ VPValue *SplatStep = Builder.createNaryOp(VPInstruction::Broadcast, Step);
+ Init = Builder.createNaryOp(MulOp, {Init, SplatStep}, Flags);
+ }
----------------
fhahn wrote:
We have this fold here: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp#L1251
`m_One` should probably look through `m_Broadcast`, or `m_Broadcast(Constant)` should get folded to just `Constant`, so the existing folds take care of this?
https://github.com/llvm/llvm-project/pull/170159
More information about the llvm-commits
mailing list