[LV] Strip createStepForVF (NFC) (#185668)

The mul -> shl simplification is already done in VPlan.
This commit is contained in:
Ramkumar Ramachandra 2026-04-02 10:04:37 +01:00 committed by GitHub
parent 018e048daf
commit d835dd2b43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 2 additions and 21 deletions

View File

@ -786,20 +786,6 @@ createLVAnalysis(const char *PassName, StringRef RemarkName, Loop *TheLoop,
namespace llvm {
/// Return a value for Step multiplied by VF.
Value *createStepForVF(IRBuilderBase &B, Type *Ty, ElementCount VF,
int64_t Step) {
assert(Ty->isIntegerTy() && "Expected an integer step");
ElementCount VFxStep = VF.multiplyCoefficientBy(Step);
assert(isPowerOf2_64(VF.getKnownMinValue()) && "must pass power-of-2 VF");
if (VF.isScalable() && isPowerOf2_64(Step)) {
return B.CreateShl(
B.CreateVScale(Ty),
ConstantInt::get(Ty, Log2_64(VFxStep.getKnownMinValue())), "", true);
}
return B.CreateElementCount(Ty, VFxStep);
}
/// Return the runtime value for VF.
Value *getRuntimeVF(IRBuilderBase &B, Type *Ty, ElementCount VF) {
return B.CreateElementCount(Ty, VF);

View File

@ -46,10 +46,6 @@ class Value;
/// vectors it is an expression determined at runtime.
Value *getRuntimeVF(IRBuilderBase &B, Type *Ty, ElementCount VF);
/// Return a value for Step multiplied by VF.
Value *createStepForVF(IRBuilderBase &B, Type *Ty, ElementCount VF,
int64_t Step);
/// Compute the transformed value of Index at offset StartValue using step
/// StepValue.
/// For integer induction, returns StartValue + Index * StepValue.

View File

@ -2606,8 +2606,6 @@ void VPScalarIVStepsRecipe::execute(VPTransformState &State) {
/*ImplicitTrunc=*/true)
: ConstantFP::get(BaseIVTy, Lane);
Value *StartIdx = Builder.CreateBinOp(AddOp, StartIdx0, LaneValue);
// The step returned by `createStepForVF` is a runtime-evaluated value
// when VF is scalable. Otherwise, it should be folded into a Constant.
assert((State.VF.isScalable() || isa<Constant>(StartIdx)) &&
"Expected StartIdx to be folded to a constant when VF is not "
"scalable");
@ -4571,7 +4569,8 @@ void VPWidenCanonicalIVRecipe::execute(VPTransformState &State) {
Value *VStart = VF.isScalar()
? CanonicalIV
: Builder.CreateVectorSplat(VF, CanonicalIV, "broadcast");
Value *VStep = createStepForVF(Builder, STy, VF, getUnrollPart(*this));
Value *VStep = Builder.CreateElementCount(
STy, VF.multiplyCoefficientBy(getUnrollPart(*this)));
if (VF.isVector()) {
VStep = Builder.CreateVectorSplat(VF, VStep);
VStep =