Author: Florian Hahn
Date: 2025-12-20T22:53:18Z
New Revision: 0d60a26cd103b346af118962ae5dda2cac7ac7bc

URL: 
https://github.com/llvm/llvm-project/commit/0d60a26cd103b346af118962ae5dda2cac7ac7bc
DIFF: 
https://github.com/llvm/llvm-project/commit/0d60a26cd103b346af118962ae5dda2cac7ac7bc.diff

LOG: Revert "[VPlan] Use predicate from VPValue VPWidenSelectR::computeCost. 
(#172…"

This reverts commit e77246dbf43352c7d61e48f79ed08b39b452fdbd.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
    llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp 
b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index f4ecb126c1a1d..24881926cf116 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -1964,8 +1964,9 @@ InstructionCost 
VPWidenSelectRecipe::computeCost(ElementCount VF,
   if (!ScalarCond)
     CondTy = VectorType::get(CondTy, VF);
 
-  llvm::CmpPredicate Pred;
-  match(getOperand(0), m_Cmp(Pred, m_VPValue(), m_VPValue()));
+  CmpInst::Predicate Pred = CmpInst::BAD_ICMP_PREDICATE;
+  if (auto *Cmp = dyn_cast<CmpInst>(SI->getCondition()))
+    Pred = Cmp->getPredicate();
   return Ctx.TTI.getCmpSelInstrCost(
       Instruction::Select, VectorTy, CondTy, Pred, Ctx.CostKind,
       {TTI::OK_AnyValue, TTI::OP_None}, {TTI::OK_AnyValue, TTI::OP_None}, SI);

diff  --git a/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll 
b/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
index 9460705e61c9c..7fcfcf05b89ca 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
@@ -92,10 +92,10 @@ exit:
 
 define i32 @select_xor_cond(ptr %src, i1 %c.0) {
 ; CHECK: LV: Checking a loop in 'select_xor_cond'
-; CHECK: Cost of 1 for VF 2: WIDEN-SELECT ir<%sel> = select ir<%c>, ir<false>, 
ir<%c.0>
-; CHECK: Cost of 1 for VF 4: WIDEN-SELECT ir<%sel> = select ir<%c>, ir<false>, 
ir<%c.0>
-; CHECK: Cost of 1 for VF 8: WIDEN-SELECT ir<%sel> = select ir<%c>, ir<false>, 
ir<%c.0>
-; CHECK: Cost of 1 for VF 16: WIDEN-SELECT ir<%sel> = select ir<%c>, 
ir<false>, ir<%c.0>
+; CHECK: Cost of 6 for VF 2: WIDEN-SELECT ir<%sel> = select ir<%c>, ir<false>, 
ir<%c.0>
+; CHECK: Cost of 12 for VF 4: WIDEN-SELECT ir<%sel> = select ir<%c>, 
ir<false>, ir<%c.0>
+; CHECK: Cost of 24 for VF 8: WIDEN-SELECT ir<%sel> = select ir<%c>, 
ir<false>, ir<%c.0>
+; CHECK: Cost of 48 for VF 16: WIDEN-SELECT ir<%sel> = select ir<%c>, 
ir<false>, ir<%c.0>
 ; CHECK: LV: Selecting VF: 4.
 
 entry:


        
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to