[llvm] [RISCV] Allow non-loop invariant steps in RISCVGatherScatterLowering (PR #122244)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 16 03:25:34 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());
----------------
lukel97 wrote:
Good eye, should be fixed now.
https://github.com/llvm/llvm-project/pull/122244
More information about the llvm-commits
mailing list