@@ -300,12 +300,12 @@ InstructionCost
300
300
VPPartialReductionRecipe::computeCost (ElementCount VF,
301
301
VPCostContext &Ctx) const {
302
302
std::optional<unsigned > Opcode;
303
- VPValue *Op = getOperand (0 );
303
+ VPValue *Op = getOperand (1 );
304
304
VPRecipeBase *OpR = Op->getDefiningRecipe ();
305
305
306
- // If the partial reduction is predicated, a select will be operand 0
306
+ // If the partial reduction is predicated, a select will be operand 1
307
307
using namespace llvm ::VPlanPatternMatch;
308
- if (match (getOperand ( 1 ) , m_Select (m_VPValue (), m_VPValue (Op), m_VPValue ()))) {
308
+ if (match (Op , m_Select (m_VPValue (), m_VPValue (Op), m_VPValue ()))) {
309
309
OpR = Op->getDefiningRecipe ();
310
310
}
311
311
@@ -2907,10 +2907,8 @@ void VPExpressionRecipe::print(raw_ostream &O, const Twine &Indent,
2907
2907
switch (ExpressionType) {
2908
2908
case ExpressionTypes::ExtendedReduction: {
2909
2909
getOperand (1 )->printAsOperand (O, SlotTracker);
2910
- O << " + " ;
2911
- if (IsPartialReduction)
2912
- O << " partial." ;
2913
- O << " reduce." << Instruction::getOpcodeName (Opcode) << " (" ;
2910
+ O << " + " << (IsPartialReduction ? " partial." : " " ) << " reduce." ;
2911
+ O << Instruction::getOpcodeName (Opcode) << " (" ;
2914
2912
getOperand (0 )->printAsOperand (O, SlotTracker);
2915
2913
Red->printFlags (O);
2916
2914
@@ -2926,11 +2924,8 @@ void VPExpressionRecipe::print(raw_ostream &O, const Twine &Indent,
2926
2924
}
2927
2925
case ExpressionTypes::ExtNegatedMulAccReduction: {
2928
2926
getOperand (getNumOperands () - 1 )->printAsOperand (O, SlotTracker);
2929
- O << " + " ;
2930
- if (IsPartialReduction)
2931
- O << " partial." ;
2932
- O << " reduce."
2933
- << Instruction::getOpcodeName (
2927
+ O << " + " << (IsPartialReduction ? " partial." : " " ) << " reduce." ;
2928
+ O << Instruction::getOpcodeName (
2934
2929
RecurrenceDescriptor::getOpcode (Red->getRecurrenceKind ()))
2935
2930
<< " (sub (0, mul" ;
2936
2931
auto *Mul = cast<VPWidenRecipe>(ExpressionRecipes[2 ]);
@@ -2954,11 +2949,8 @@ void VPExpressionRecipe::print(raw_ostream &O, const Twine &Indent,
2954
2949
case ExpressionTypes::MulAccReduction:
2955
2950
case ExpressionTypes::ExtMulAccReduction: {
2956
2951
getOperand (getNumOperands () - 1 )->printAsOperand (O, SlotTracker);
2957
- O << " + " ;
2958
- if (IsPartialReduction)
2959
- O << " partial." ;
2960
- O << " reduce."
2961
- << Instruction::getOpcodeName (
2952
+ O << " + " << (IsPartialReduction ? " partial." : " " ) << " reduce." ;
2953
+ O << Instruction::getOpcodeName (
2962
2954
RecurrenceDescriptor::getOpcode (Red->getRecurrenceKind ()))
2963
2955
<< " (" ;
2964
2956
O << " mul" ;
0 commit comments