@@ -2224,8 +2224,7 @@ void VPReductionRecipe::execute(VPTransformState &State) {
22242224 RecurKind Kind = RdxDesc.getRecurrenceKind ();
22252225 // Propagate the fast-math flags carried by the underlying instruction.
22262226 IRBuilderBase::FastMathFlagGuard FMFGuard (State.Builder );
2227- if (hasFastMathFlags ())
2228- State.Builder .setFastMathFlags (getFastMathFlags ());
2227+ State.Builder .setFastMathFlags (getFastMathFlags ());
22292228 State.setDebugLocFrom (getDebugLoc ());
22302229 Value *NewVecOp = State.get (getVecOp ());
22312230 if (VPValue *Cond = getCondOp ()) {
@@ -2276,8 +2275,7 @@ void VPReductionEVLRecipe::execute(VPTransformState &State) {
22762275 // Propagate the fast-math flags carried by the underlying instruction.
22772276 IRBuilderBase::FastMathFlagGuard FMFGuard (Builder);
22782277 const RecurrenceDescriptor &RdxDesc = getRecurrenceDescriptor ();
2279- if (hasFastMathFlags ())
2280- Builder.setFastMathFlags (getFastMathFlags ());
2278+ Builder.setFastMathFlags (getFastMathFlags ());
22812279
22822280 RecurKind Kind = RdxDesc.getRecurrenceKind ();
22832281 Value *Prev = State.get (getChainOp (), /* IsScalar*/ true );
@@ -2314,8 +2312,7 @@ InstructionCost VPReductionRecipe::computeCost(ElementCount VF,
23142312 Type *ElementTy = Ctx.Types .inferScalarType (this );
23152313 auto *VectorTy = cast<VectorType>(toVectorTy (ElementTy, VF));
23162314 unsigned Opcode = RdxDesc.getOpcode ();
2317- FastMathFlags FMFs =
2318- hasFastMathFlags () ? getFastMathFlags () : FastMathFlags ();
2315+ FastMathFlags FMFs = getFastMathFlags ();
23192316
23202317 // TODO: Support any-of and in-loop reductions.
23212318 assert (
@@ -2351,7 +2348,8 @@ void VPReductionRecipe::print(raw_ostream &O, const Twine &Indent,
23512348 O << " = " ;
23522349 getChainOp ()->printAsOperand (O, SlotTracker);
23532350 O << " +" ;
2354- printFlags (O);
2351+ if (isa<FPMathOperator>(getUnderlyingInstr ()))
2352+ printFlags (O);
23552353 O << " reduce." << Instruction::getOpcodeName (RdxDesc.getOpcode ()) << " (" ;
23562354 getVecOp ()->printAsOperand (O, SlotTracker);
23572355 if (isConditional ()) {
@@ -2372,7 +2370,8 @@ void VPReductionEVLRecipe::print(raw_ostream &O, const Twine &Indent,
23722370 O << " = " ;
23732371 getChainOp ()->printAsOperand (O, SlotTracker);
23742372 O << " +" ;
2375- printFlags (O);
2373+ if (isa<FPMathOperator>(getUnderlyingInstr ()))
2374+ printFlags (O);
23762375 O << " vp.reduce." << Instruction::getOpcodeName (RdxDesc.getOpcode ()) << " (" ;
23772376 getVecOp ()->printAsOperand (O, SlotTracker);
23782377 O << " , " ;
0 commit comments