Skip to content

Commit f42af14

Browse files
authored
Revert "[VPlan] Use predicate from VPValue VPWidenSelectR::computeCost." (#173170)
Reverts #172915 Looks like this may be causing https://lab.llvm.org/buildbot/#/builders/128/builds/9590 to fail. Revert while I confirm.
1 parent 21571cf commit f42af14

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,8 +1964,9 @@ InstructionCost VPWidenSelectRecipe::computeCost(ElementCount VF,
19641964
if (!ScalarCond)
19651965
CondTy = VectorType::get(CondTy, VF);
19661966

1967-
llvm::CmpPredicate Pred;
1968-
match(getOperand(0), m_Cmp(Pred, m_VPValue(), m_VPValue()));
1967+
CmpInst::Predicate Pred = CmpInst::BAD_ICMP_PREDICATE;
1968+
if (auto *Cmp = dyn_cast<CmpInst>(SI->getCondition()))
1969+
Pred = Cmp->getPredicate();
19691970
return Ctx.TTI.getCmpSelInstrCost(
19701971
Instruction::Select, VectorTy, CondTy, Pred, Ctx.CostKind,
19711972
{TTI::OK_AnyValue, TTI::OP_None}, {TTI::OK_AnyValue, TTI::OP_None}, SI);

llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ exit:
9292

9393
define i32 @select_xor_cond(ptr %src, i1 %c.0) {
9494
; CHECK: LV: Checking a loop in 'select_xor_cond'
95-
; CHECK: Cost of 1 for VF 2: WIDEN-SELECT ir<%sel> = select ir<%c>, ir<false>, ir<%c.0>
96-
; CHECK: Cost of 1 for VF 4: WIDEN-SELECT ir<%sel> = select ir<%c>, ir<false>, ir<%c.0>
97-
; CHECK: Cost of 1 for VF 8: WIDEN-SELECT ir<%sel> = select ir<%c>, ir<false>, ir<%c.0>
98-
; CHECK: Cost of 1 for VF 16: WIDEN-SELECT ir<%sel> = select ir<%c>, ir<false>, ir<%c.0>
95+
; CHECK: Cost of 6 for VF 2: WIDEN-SELECT ir<%sel> = select ir<%c>, ir<false>, ir<%c.0>
96+
; CHECK: Cost of 12 for VF 4: WIDEN-SELECT ir<%sel> = select ir<%c>, ir<false>, ir<%c.0>
97+
; CHECK: Cost of 24 for VF 8: WIDEN-SELECT ir<%sel> = select ir<%c>, ir<false>, ir<%c.0>
98+
; CHECK: Cost of 48 for VF 16: WIDEN-SELECT ir<%sel> = select ir<%c>, ir<false>, ir<%c.0>
9999
; CHECK: LV: Selecting VF: 4.
100100

101101
entry:

0 commit comments

Comments
 (0)