@@ -2312,8 +2312,9 @@ void VPReductionRecipe::execute(VPTransformState &State) {
23122312 NewRed =
23132313 createOrderedReduction (State.Builder , Kind, NewVecOp, PrevInChain);
23142314 else
2315- NewRed = State.Builder .CreateBinOp ((Instruction::BinaryOps)getOpcode (),
2316- PrevInChain, NewVecOp);
2315+ NewRed = State.Builder .CreateBinOp (
2316+ (Instruction::BinaryOps)RecurrenceDescriptor::getOpcode (Kind),
2317+ PrevInChain, NewVecOp);
23172318 PrevInChain = NewRed;
23182319 NextInChain = NewRed;
23192320 } else {
@@ -2323,7 +2324,8 @@ void VPReductionRecipe::execute(VPTransformState &State) {
23232324 NextInChain = createMinMaxOp (State.Builder , Kind, NewRed, PrevInChain);
23242325 else
23252326 NextInChain = State.Builder .CreateBinOp (
2326- (Instruction::BinaryOps)getOpcode (), NewRed, PrevInChain);
2327+ (Instruction::BinaryOps)RecurrenceDescriptor::getOpcode (Kind), NewRed,
2328+ PrevInChain);
23272329 }
23282330 State.set (this , NextInChain, /* IsScalar*/ true );
23292331}
@@ -2359,8 +2361,9 @@ void VPReductionEVLRecipe::execute(VPTransformState &State) {
23592361 if (RecurrenceDescriptor::isMinMaxRecurrenceKind (Kind))
23602362 NewRed = createMinMaxOp (Builder, Kind, NewRed, Prev);
23612363 else
2362- NewRed = Builder.CreateBinOp ((Instruction::BinaryOps)getOpcode (), NewRed,
2363- Prev);
2364+ NewRed = Builder.CreateBinOp (
2365+ (Instruction::BinaryOps)RecurrenceDescriptor::getOpcode (Kind), NewRed,
2366+ Prev);
23642367 }
23652368 State.set (this , NewRed, /* IsScalar*/ true );
23662369}
@@ -2370,7 +2373,7 @@ InstructionCost VPReductionRecipe::computeCost(ElementCount VF,
23702373 RecurKind RdxKind = getRecurrenceKind ();
23712374 Type *ElementTy = Ctx.Types .inferScalarType (this );
23722375 auto *VectorTy = cast<VectorType>(toVectorTy (ElementTy, VF));
2373- unsigned Opcode = getOpcode ();
2376+ unsigned Opcode = RecurrenceDescriptor:: getOpcode (RdxKind );
23742377 FastMathFlags FMFs = getFastMathFlags ();
23752378
23762379 // TODO: Support any-of and in-loop reductions.
@@ -2405,7 +2408,10 @@ void VPReductionRecipe::print(raw_ostream &O, const Twine &Indent,
24052408 getChainOp ()->printAsOperand (O, SlotTracker);
24062409 O << " +" ;
24072410 printFlags (O);
2408- O << " reduce." << Instruction::getOpcodeName (getOpcode ()) << " (" ;
2411+ O << " reduce."
2412+ << Instruction::getOpcodeName (
2413+ RecurrenceDescriptor::getOpcode (getRecurrenceKind ()))
2414+ << " (" ;
24092415 getVecOp ()->printAsOperand (O, SlotTracker);
24102416 if (isConditional ()) {
24112417 O << " , " ;
@@ -2422,7 +2428,10 @@ void VPReductionEVLRecipe::print(raw_ostream &O, const Twine &Indent,
24222428 getChainOp ()->printAsOperand (O, SlotTracker);
24232429 O << " +" ;
24242430 printFlags (O);
2425- O << " vp.reduce." << Instruction::getOpcodeName (getOpcode ()) << " (" ;
2431+ O << " vp.reduce."
2432+ << Instruction::getOpcodeName (
2433+ RecurrenceDescriptor::getOpcode (getRecurrenceKind ()))
2434+ << " (" ;
24262435 getVecOp ()->printAsOperand (O, SlotTracker);
24272436 O << " , " ;
24282437 getEVL ()->printAsOperand (O, SlotTracker);
0 commit comments