[llvm] [RISCV] Allow non-loop invariant steps in RISCVGatherScatterLowering (PR #122244)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 11:59:05 PST 2025
================
@@ -310,18 +307,31 @@ bool RISCVGatherScatterLowering::matchStridedRecurrence(Value *Index, Loop *L,
}
case Instruction::Mul: {
Start = Builder.CreateMul(Start, SplatOp, "start");
- Step = Builder.CreateMul(Step, SplatOp, "step");
Stride = Builder.CreateMul(Stride, SplatOp, "stride");
break;
}
case Instruction::Shl: {
Start = Builder.CreateShl(Start, SplatOp, "start");
- Step = Builder.CreateShl(Step, SplatOp, "step");
Stride = Builder.CreateShl(Stride, SplatOp, "stride");
break;
}
}
+ // Adjust the step value after its definition if it's an instruction.
+ if (auto *StepI = dyn_cast<Instruction>(Step))
+ Builder.SetInsertPoint(*StepI->getInsertionPointAfterDef());
----------------
topperc wrote:
Is it possible it puts it somewhere that SplatOp doesn't dominate?
https://github.com/llvm/llvm-project/pull/122244
More information about the llvm-commits
mailing list