[llvm-branch-commits] [llvm] [SLP] Pass a lane as the vector cost context only if all lanes agree (PR #241758)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Nov 12 01:59:46 PST 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-vectorizers
@llvm/pr-subscribers-backend-amdgpu
Author: michaelselehov
<details>
<summary>Changes</summary>
getEntryCost prices a vector instruction with one scalar lane as the context, while each scalar lane is priced in its own context. A target that reads the context, like the users of an fmul that fuses into an fma on AMDGPU or a sibling udiv of a urem on X86, gives the whole vector the property of that one lane.
Pass the lane as the context only if the vector cost is the same with any of the represented lanes as the context.
Fixes: ROCM-34183
Assisted-by: Claude Opus
---
Patch is 21.30 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/241758.diff
6 Files Affected:
- (modified) llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp (+103-31)
- (modified) llvm/test/Transforms/SLPVectorizer/AArch64/and-bsl-ctx-mixed-lanes.ll (+14-11)
- (modified) llvm/test/Transforms/SLPVectorizer/AMDGPU/fdiv-afn-ctx-lanes.ll (+14-7)
- (modified) llvm/test/Transforms/SLPVectorizer/AMDGPU/fmul-fusion-ctx-mixed-lanes.ll (+21-7)
- (modified) llvm/test/Transforms/SLPVectorizer/X86/remark-alt-cmp-ctx-lanes.ll (+1-1)
- (modified) llvm/test/Transforms/SLPVectorizer/X86/urem-div-ctx-mixed-lanes.ll (+23-4)
``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index fbdb3501a9f7e..a615abc41d385 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -16676,6 +16676,26 @@ static std::optional<unsigned> getCastOpcodeForDemotedOperand(unsigned Opcode,
}
}
+/// Returns \p Cost with \p Repr as the context if every lane of \p VL that
+/// \p Repr represents gives the same cost as its context, and \p Cost without
+/// a context otherwise.
+static InstructionCost getCostInAgreedContext(
+ ArrayRef<Value *> VL, Instruction *Repr,
+ function_ref<bool(Instruction *)> IsReprLane,
+ function_ref<InstructionCost(const Instruction *)> Cost) {
+ if (!Repr || !IsReprLane(Repr) || !is_contained(VL, Repr))
+ return Cost(nullptr);
+ const InstructionCost ReprCost = Cost(Repr);
+ SmallPtrSet<Instruction *, 8> Checked;
+ Checked.insert(Repr);
+ for (Value *V : VL) {
+ auto *I = dyn_cast<Instruction>(V);
+ if (I && IsReprLane(I) && Checked.insert(I).second && Cost(I) != ReprCost)
+ return Cost(nullptr);
+ }
+ return ReprCost;
+}
+
InstructionCost
BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
SmallPtrSetImpl<Value *> &CheckedExtracts) {
@@ -17317,8 +17337,16 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
SrcVecTy->getScalarType(),
TTI::getCastContextHint(VL0), CostKind) == 0)
VI = nullptr;
- return CommonCost + TTI->getCastInstrCost(VecOpcode, VecTy, SrcVecTy, CCH,
- CostKind, VI);
+ return CommonCost +
+ getCostInAgreedContext(
+ E->Scalars, VI,
+ [&](Instruction *I) {
+ return I->getOpcode() == Opcode && !E->isCopyableElement(I);
+ },
+ [&](const Instruction *CtxI) {
+ return TTI->getCastInstrCost(VecOpcode, VecTy, SrcVecTy, CCH,
+ CostKind, CtxI);
+ });
};
return GetCostDiff(GetScalarCost, GetVectorCost);
}
@@ -17469,13 +17497,21 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
}
}
if (!VecCost.isValid()) {
- VecCost = TTI->getCmpSelInstrCost(
- E->getOpcode(), VecTy, MaskTy, VecPred, CostKind,
- TTI::getOperandInfo(
- E->getOperand(ShuffleOrOp == Instruction::Select ? 1 : 0)),
- TTI::getOperandInfo(
- E->getOperand(ShuffleOrOp == Instruction::Select ? 2 : 1)),
- VL0);
+ TTI::OperandValueInfo Op1Info = TTI::getOperandInfo(
+ E->getOperand(ShuffleOrOp == Instruction::Select ? 1 : 0));
+ TTI::OperandValueInfo Op2Info = TTI::getOperandInfo(
+ E->getOperand(ShuffleOrOp == Instruction::Select ? 2 : 1));
+ VecCost = getCostInAgreedContext(
+ E->Scalars, VL0,
+ [&](Instruction *I) {
+ return I->getOpcode() == E->getOpcode() &&
+ !E->isCopyableElement(I);
+ },
+ [&](const Instruction *CtxI) {
+ return TTI->getCmpSelInstrCost(E->getOpcode(), VecTy, MaskTy,
+ VecPred, CostKind, Op1Info,
+ Op2Info, CtxI);
+ });
if (IsBitTest)
VecCost +=
TTI->getArithmeticInstrCost(Instruction::And, VecTy, CostKind);
@@ -17807,9 +17843,20 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
unsigned OpIdx = isa<UnaryOperator>(VL0) ? 0 : 1;
TTI::OperandValueInfo Op1Info = TTI::getOperandInfo(E->getOperand(0));
TTI::OperandValueInfo Op2Info = TTI::getOperandInfo(E->getOperand(OpIdx));
- InstructionCost Cost = TTI->getArithmeticInstrCost(
- ShuffleOrOp, VecTy, CostKind, Op1Info, Op2Info, {},
- VL0->getOpcode() == ShuffleOrOp ? VL0 : nullptr, TLI);
+ auto GetBinOpCost = [&](TTI::OperandValueInfo LHSInfo,
+ TTI::OperandValueInfo RHSInfo) {
+ return getCostInAgreedContext(
+ E->Scalars, VL0,
+ [&](Instruction *I) {
+ return I->getOpcode() == ShuffleOrOp && !E->isCopyableElement(I);
+ },
+ [&](const Instruction *CtxI) {
+ return TTI->getArithmeticInstrCost(ShuffleOrOp, VecTy, CostKind,
+ LHSInfo, RHSInfo, {}, CtxI,
+ TLI);
+ });
+ };
+ InstructionCost Cost = GetBinOpCost(Op1Info, Op2Info);
// N columns need N-1 vector combines; price extra columns
// conservatively, skipping identity-only columns (not combined by
// codegen).
@@ -17823,10 +17870,7 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
continue;
// The first operand is the running fold, a computed value with no
// static properties to model.
- Cost += TTI->getArithmeticInstrCost(
- ShuffleOrOp, VecTy, CostKind, {},
- TTI::getOperandInfo(E->getOperand(Idx)), {},
- VL0->getOpcode() == ShuffleOrOp ? VL0 : nullptr, TLI);
+ Cost += GetBinOpCost({}, TTI::getOperandInfo(E->getOperand(Idx)));
}
}
return Cost + CommonCost;
@@ -18156,6 +18200,21 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
// VecCost is equal to sum of the cost of creating 2 vectors
// and the cost of creating shuffle.
InstructionCost VecCost = 0;
+ // Lanes are split the way the alternate shuffle mask splits them; for
+ // compares this tells the predicates apart, not only the opcodes.
+ auto GetAltCost =
+ [&](Instruction *Repr,
+ function_ref<InstructionCost(const Instruction *)> Cost) {
+ const bool IsAlt = Repr == E->getAltOp();
+ return getCostInAgreedContext(
+ E->Scalars, Repr,
+ [&](Instruction *I) {
+ return !E->isCopyableElement(I) &&
+ isAlternateInstruction(I, E->getMainOp(),
+ E->getAltOp(), *TLI) == IsAlt;
+ },
+ Cost);
+ };
if (TryFindNodeWithEqualOperands()) {
LLVM_DEBUG({
dbgs() << "SLP: diamond match for alternate node found.\n";
@@ -18174,16 +18233,19 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
// folded column is uniform.
auto ChainCost = [&](unsigned Opcode) {
InstructionCost Cost = 0;
+ Instruction *Repr =
+ Opcode == E->getOpcode() ? E->getMainOp() : E->getAltOp();
TTI::OperandValueInfo RunningInfo =
TTI::getOperandInfo(E->getOperand(0));
for (unsigned Idx : seq<unsigned>(1, E->getNumOperands())) {
TTI::OperandValueInfo ColInfo =
TTI::getOperandInfo(E->getOperand(Idx));
if (!RunningInfo.isConstant() || !ColInfo.isConstant())
- Cost += TTIRef.getArithmeticInstrCost(
- Opcode, VecTy, CostKind, RunningInfo, ColInfo, {},
- Opcode == E->getOpcode() ? E->getMainOp() : E->getAltOp(),
- TLI);
+ Cost += GetAltCost(Repr, [&](const Instruction *CtxI) {
+ return TTIRef.getArithmeticInstrCost(Opcode, VecTy, CostKind,
+ RunningInfo, ColInfo, {},
+ CtxI, TLI);
+ });
TTI::OperandValueKind Kind = TTI::OK_AnyValue;
if (RunningInfo.isConstant() && ColInfo.isConstant())
Kind = RunningInfo.Kind == TTI::OK_UniformConstantValue &&
@@ -18201,13 +18263,16 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
auto *MaskTy = getWidenedType(Builder.getInt1Ty(), VL.size());
TTI::OperandValueInfo Op0Info = TTI::getOperandInfo(E->getOperand(0));
TTI::OperandValueInfo Op1Info = TTI::getOperandInfo(E->getOperand(1));
- VecCost = TTIRef.getCmpSelInstrCost(E->getOpcode(), VecTy, MaskTy,
- CI0->getPredicate(), CostKind,
- Op0Info, Op1Info, VL0);
- VecCost += TTIRef.getCmpSelInstrCost(
- E->getOpcode(), VecTy, MaskTy,
- cast<CmpInst>(E->getAltOp())->getPredicate(), CostKind, Op0Info,
- Op1Info, E->getAltOp());
+ auto CmpCost = [&](Instruction *Repr, CmpInst::Predicate Pred) {
+ return GetAltCost(Repr, [&](const Instruction *CtxI) {
+ return TTIRef.getCmpSelInstrCost(E->getOpcode(), VecTy, MaskTy,
+ Pred, CostKind, Op0Info, Op1Info,
+ CtxI);
+ });
+ };
+ VecCost = CmpCost(VL0, CI0->getPredicate()) +
+ CmpCost(E->getAltOp(),
+ cast<CmpInst>(E->getAltOp())->getPredicate());
} else {
Type *SrcTy =
getWidenedType(E->getMainOp()->getOperand(0)->getType(), VL.size());
@@ -18254,10 +18319,17 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
if (Opcode0 == Opcode1)
return VecCost +
TTIRef.getCastInstrCost(Opcode0, VecTy, SrcTy, CCH, CostKind);
- VecCost += TTIRef.getCastInstrCost(Opcode0, VecTy, SrcTy, CCH, CostKind,
- E->getMainOp());
- VecCost += TTIRef.getCastInstrCost(Opcode1, VecTy, SrcTy, CCH, CostKind,
- E->getAltOp());
+ // A demoted cast is not the instruction it was demoted from, so the
+ // original cast is no context for it.
+ auto CastCost = [&](unsigned Opcode, Instruction *Repr) {
+ return GetAltCost(Repr->getOpcode() == Opcode ? Repr : nullptr,
+ [&](const Instruction *CtxI) {
+ return TTIRef.getCastInstrCost(
+ Opcode, VecTy, SrcTy, CCH, CostKind, CtxI);
+ });
+ };
+ VecCost += CastCost(Opcode0, E->getMainOp()) +
+ CastCost(Opcode1, E->getAltOp());
}
SmallVector<int> Mask;
E->buildAltOpShuffleMask(
diff --git a/llvm/test/Transforms/SLPVectorizer/AArch64/and-bsl-ctx-mixed-lanes.ll b/llvm/test/Transforms/SLPVectorizer/AArch64/and-bsl-ctx-mixed-lanes.ll
index be287c280fad0..d8b22e20b73f3 100644
--- a/llvm/test/Transforms/SLPVectorizer/AArch64/and-bsl-ctx-mixed-lanes.ll
+++ b/llvm/test/Transforms/SLPVectorizer/AArch64/and-bsl-ctx-mixed-lanes.ll
@@ -10,17 +10,20 @@ define void @bsl_lane0(ptr %x, i64 %y, i64 %m0, i64 %m1, i64 %w1, ptr %out) {
; CHECK-LABEL: define void @bsl_lane0(
; CHECK-SAME: ptr [[X:%.*]], i64 [[Y:%.*]], i64 [[M0:%.*]], i64 [[M1:%.*]], i64 [[W1:%.*]], ptr [[OUT:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
-; CHECK-NEXT: [[TMP0:%.*]] = insertelement <2 x i64> poison, i64 [[M0]], i64 0
-; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i64> [[TMP0]], i64 [[W1]], i64 1
-; CHECK-NEXT: [[TMP2:%.*]] = xor <2 x i64> [[TMP1]], splat (i64 -1)
-; CHECK-NEXT: [[TMP3:%.*]] = load <2 x i64>, ptr [[X]], align 8
-; CHECK-NEXT: [[TMP4:%.*]] = insertelement <2 x i64> [[TMP1]], i64 [[M1]], i64 1
-; CHECK-NEXT: [[TMP5:%.*]] = and <2 x i64> [[TMP3]], [[TMP4]]
-; CHECK-NEXT: [[TMP6:%.*]] = insertelement <2 x i64> poison, i64 [[Y]], i64 0
-; CHECK-NEXT: [[TMP7:%.*]] = shufflevector <2 x i64> [[TMP6]], <2 x i64> poison, <2 x i32> zeroinitializer
-; CHECK-NEXT: [[TMP8:%.*]] = and <2 x i64> [[TMP7]], [[TMP2]]
-; CHECK-NEXT: [[TMP9:%.*]] = or <2 x i64> [[TMP5]], [[TMP8]]
-; CHECK-NEXT: store <2 x i64> [[TMP9]], ptr [[OUT]], align 8
+; CHECK-NEXT: [[X0:%.*]] = load i64, ptr [[X]], align 8
+; CHECK-NEXT: [[PX1:%.*]] = getelementptr inbounds i64, ptr [[X]], i64 1
+; CHECK-NEXT: [[X1:%.*]] = load i64, ptr [[PX1]], align 8
+; CHECK-NEXT: [[N0:%.*]] = xor i64 [[M0]], -1
+; CHECK-NEXT: [[N1:%.*]] = xor i64 [[W1]], -1
+; CHECK-NEXT: [[A0:%.*]] = and i64 [[X0]], [[M0]]
+; CHECK-NEXT: [[A1:%.*]] = and i64 [[X1]], [[M1]]
+; CHECK-NEXT: [[B0:%.*]] = and i64 [[Y]], [[N0]]
+; CHECK-NEXT: [[B1:%.*]] = and i64 [[Y]], [[N1]]
+; CHECK-NEXT: [[O0:%.*]] = or i64 [[A0]], [[B0]]
+; CHECK-NEXT: [[O1:%.*]] = or i64 [[A1]], [[B1]]
+; CHECK-NEXT: store i64 [[O0]], ptr [[OUT]], align 8
+; CHECK-NEXT: [[PO1:%.*]] = getelementptr inbounds i64, ptr [[OUT]], i64 1
+; CHECK-NEXT: store i64 [[O1]], ptr [[PO1]], align 8
; CHECK-NEXT: ret void
;
entry:
diff --git a/llvm/test/Transforms/SLPVectorizer/AMDGPU/fdiv-afn-ctx-lanes.ll b/llvm/test/Transforms/SLPVectorizer/AMDGPU/fdiv-afn-ctx-lanes.ll
index 8b9554af55bae..f8953761552fc 100644
--- a/llvm/test/Transforms/SLPVectorizer/AMDGPU/fdiv-afn-ctx-lanes.ll
+++ b/llvm/test/Transforms/SLPVectorizer/AMDGPU/fdiv-afn-ctx-lanes.ll
@@ -9,17 +9,24 @@ define void @fdiv_mixed(ptr %a, ptr %b, ptr %out) {
; CHECK-LABEL: define void @fdiv_mixed(
; CHECK-SAME: ptr [[A:%.*]], ptr [[B:%.*]], ptr [[OUT:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
-; CHECK-NEXT: [[AP1:%.*]] = getelementptr inbounds float, ptr [[A]], i64 2
-; CHECK-NEXT: [[BP1:%.*]] = getelementptr inbounds float, ptr [[B]], i64 2
-; CHECK-NEXT: [[TMP3:%.*]] = load <2 x float>, ptr [[A]], align 4
-; CHECK-NEXT: [[TMP4:%.*]] = load <2 x float>, ptr [[B]], align 4
-; CHECK-NEXT: [[TMP5:%.*]] = fdiv <2 x float> [[TMP3]], [[TMP4]]
-; CHECK-NEXT: [[O1:%.*]] = getelementptr inbounds float, ptr [[OUT]], i64 2
+; CHECK-NEXT: [[A0:%.*]] = load float, ptr [[A]], align 4
+; CHECK-NEXT: [[AP1:%.*]] = getelementptr inbounds float, ptr [[A]], i64 1
+; CHECK-NEXT: [[AP3:%.*]] = getelementptr inbounds float, ptr [[A]], i64 3
+; CHECK-NEXT: [[A3:%.*]] = load float, ptr [[AP3]], align 4
+; CHECK-NEXT: [[B0:%.*]] = load float, ptr [[B]], align 4
+; CHECK-NEXT: [[BP1:%.*]] = getelementptr inbounds float, ptr [[B]], i64 1
+; CHECK-NEXT: [[BP3:%.*]] = getelementptr inbounds float, ptr [[B]], i64 3
+; CHECK-NEXT: [[B3:%.*]] = load float, ptr [[BP3]], align 4
+; CHECK-NEXT: [[D0:%.*]] = fdiv afn float [[A0]], [[B0]]
+; CHECK-NEXT: [[D3:%.*]] = fdiv float [[A3]], [[B3]]
+; CHECK-NEXT: [[O1:%.*]] = getelementptr inbounds float, ptr [[OUT]], i64 1
; CHECK-NEXT: [[TMP0:%.*]] = load <2 x float>, ptr [[AP1]], align 4
; CHECK-NEXT: [[TMP1:%.*]] = load <2 x float>, ptr [[BP1]], align 4
; CHECK-NEXT: [[TMP2:%.*]] = fdiv <2 x float> [[TMP0]], [[TMP1]]
-; CHECK-NEXT: store <2 x float> [[TMP5]], ptr [[OUT]], align 4
+; CHECK-NEXT: store float [[D0]], ptr [[OUT]], align 4
; CHECK-NEXT: store <2 x float> [[TMP2]], ptr [[O1]], align 4
+; CHECK-NEXT: [[O3:%.*]] = getelementptr inbounds float, ptr [[OUT]], i64 3
+; CHECK-NEXT: store float [[D3]], ptr [[O3]], align 4
; CHECK-NEXT: ret void
;
entry:
diff --git a/llvm/test/Transforms/SLPVectorizer/AMDGPU/fmul-fusion-ctx-mixed-lanes.ll b/llvm/test/Transforms/SLPVectorizer/AMDGPU/fmul-fusion-ctx-mixed-lanes.ll
index 95e84c99925bc..2ecff1f6b7688 100644
--- a/llvm/test/Transforms/SLPVectorizer/AMDGPU/fmul-fusion-ctx-mixed-lanes.ll
+++ b/llvm/test/Transforms/SLPVectorizer/AMDGPU/fmul-fusion-ctx-mixed-lanes.ll
@@ -9,18 +9,32 @@
define double @mixed_lanes(ptr noalias %e, ptr %a, ptr %b) {
; CHECK-LABEL: define double @mixed_lanes(
; CHECK-SAME: ptr noalias [[E:%.*]], ptr [[A:%.*]], ptr [[B:%.*]]) {
-; CHECK-NEXT: [[TMP1:%.*]] = load <4 x double>, ptr [[A]], align 8
-; CHECK-NEXT: [[TMP2:%.*]] = load <4 x double>, ptr [[B]], align 8
-; CHECK-NEXT: [[TMP3:%.*]] = fmul reassoc contract <4 x double> [[TMP1]], [[TMP2]]
-; CHECK-NEXT: [[M1:%.*]] = extractelement <4 x double> [[TMP3]], i64 1
+; CHECK-NEXT: [[A0:%.*]] = load double, ptr [[A]], align 8
+; CHECK-NEXT: [[B0:%.*]] = load double, ptr [[B]], align 8
+; CHECK-NEXT: [[AP1:%.*]] = getelementptr inbounds double, ptr [[A]], i64 1
+; CHECK-NEXT: [[BP1:%.*]] = getelementptr inbounds double, ptr [[B]], i64 1
+; CHECK-NEXT: [[A1:%.*]] = load double, ptr [[AP1]], align 8
+; CHECK-NEXT: [[B1:%.*]] = load double, ptr [[BP1]], align 8
+; CHECK-NEXT: [[AP2:%.*]] = getelementptr inbounds double, ptr [[A]], i64 2
+; CHECK-NEXT: [[BP2:%.*]] = getelementptr inbounds double, ptr [[B]], i64 2
+; CHECK-NEXT: [[A2:%.*]] = load double, ptr [[AP2]], align 8
+; CHECK-NEXT: [[B2:%.*]] = load double, ptr [[BP2]], align 8
+; CHECK-NEXT: [[AP3:%.*]] = getelementptr inbounds double, ptr [[A]], i64 3
+; CHECK-NEXT: [[BP3:%.*]] = getelementptr inbounds double, ptr [[B]], i64 3
+; CHECK-NEXT: [[A3:%.*]] = load double, ptr [[AP3]], align 8
+; CHECK-NEXT: [[B3:%.*]] = load double, ptr [[BP3]], align 8
+; CHECK-NEXT: [[M0:%.*]] = fmul reassoc contract double [[A0]], [[B0]]
+; CHECK-NEXT: [[M1:%.*]] = fmul reassoc contract double [[A1]], [[B1]]
+; CHECK-NEXT: [[M2:%.*]] = fmul reassoc contract double [[A2]], [[B2]]
+; CHECK-NEXT: [[M3:%.*]] = fmul reassoc contract double [[A3]], [[B3]]
; CHECK-NEXT: store double [[M1]], ptr [[E]], align 8
; CHECK-NEXT: [[E2:%.*]] = getelementptr inbounds double, ptr [[E]], i64 1
-; CHECK-NEXT: [[M2:%.*]] = extractelement <4 x double> [[TMP3]], i64 2
; CHECK-NEXT: store double [[M2]], ptr [[E2]], align 8
; CHECK-NEXT: [[E3:%.*]] = getelementptr inbounds double, ptr [[E]], i64 2
-; CHECK-NEXT: [[M3:%.*]] = extractelement <4 x double> [[TMP3]], i64 3
; CHECK-NEXT: store double [[M3]], ptr [[E3]], align 8
-; CHECK-NEXT: [[S3:%.*]] = call reassoc contract double @llvm.vector.reduce.fadd.v4f64(double -0.000000e+00, <4 x double> [[TMP3]])
+; CHECK-NEXT: [[S1:%.*]] = fadd reassoc contract double [[M0]], [[M1]]
+; CHECK-NEXT: [[S2:%.*]] = fadd reassoc contract double [[S1]], [[M2]]
+; CHECK-NEXT: [[S3:%.*]] = fadd reassoc contract double [[S2]], [[M3]]
; CHECK-NEXT: ret double [[S3]]
;
%a0 = load double, ptr %a
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/remark-alt-cmp-ctx-lanes.ll b/llvm/test/Transforms/SLPVectorizer/X86/remark-alt-cmp-ctx-lanes.ll
index 37def1ad04f60..7c04553ccc92b 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/remark-alt-cmp-ctx-lanes.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/remark-alt-cmp-ctx-lanes.ll
@@ -12,7 +12,7 @@
; YAML-NEXT: Function: alt_cmp_ne_lanes
; YAML-NEXT: Args:
; YAML-NEXT: - String: 'Stores SLP vectorized with cost '
-; YAML-NEXT: - Cost: '-6'
+; YAML-NEXT: - Cost: '-5'
; YAML-NEXT: - String: ' and with tree size '
; YAML-NEXT: - TreeSize: '6'
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/urem-div-ctx-mixed-lanes.ll b/llvm/test/Transforms/SLPVectorizer/X86/urem-div-ctx-mixed-lanes.ll
index 2eee46f7df8a9..7929264c78f65 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/urem-div-ctx-mixed-lanes.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/urem-div-ctx-mixed-lanes.ll
@@ -9,14 +9,33 @@ define void @urem_div_lane0(ptr %a, ptr %b, ptr %r, ptr %q) {
; CHECK-LABEL: define void @urem_div_lane0(
; CHECK-SAME: ptr [[A:%.*]], ptr [[B:%.*]], ptr [[R:%.*]], ptr [[Q:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
-; CHECK-NEXT: [[TMP0:%.*]] = load <4 x i32>, ptr [[A]], align 4
; CHECK-NEXT: [[A0:%.*]] = load i32, ptr [[A]], align 4
-; CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, ptr [[B]], align 4
+; CHECK-NEXT: [[PA1:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 1
+; CHECK-NEXT: [[A1:%.*]] = load i32, ptr [[PA1]], align 4
+; CHECK-NEXT: [[PA2:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 2
+; CHECK-NEXT: [[A2:%.*]] = load i32, ptr [[PA2]], align 4
+; CHECK-NEXT: [[PA3:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 3
+; CHECK-NEXT: [[A3:%.*]] = load i32, ptr [[PA3]], align 4
; CHECK-NEXT: [[B0:%.*]] = load i32, ptr [[B]], align 4
-; CHECK-NEXT: [[TMP2:%.*]] = urem <...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/241758
More information about the llvm-branch-commits
mailing list