@@ -790,13 +790,6 @@ class VPRecipeWithIRFlags : public VPSingleDefRecipe {
790790 }
791791 }
792792
793- // / Set fast-math flags for this recipe.
794- void setFastMathFlags (FastMathFlags FMFs) {
795- assert (OpType == OperationType::FPMathOp &&
796- " We should only set the FastMathFlags when the recipes is FPFathOP" );
797- this ->FMFs = FMFs;
798- }
799-
800793 CmpInst::Predicate getPredicate () const {
801794 assert (OpType == OperationType::Cmp &&
802795 " recipe doesn't have a compare predicate" );
@@ -2304,35 +2297,32 @@ class VPReductionRecipe : public VPRecipeWithIRFlags {
23042297
23052298protected:
23062299 VPReductionRecipe (const unsigned char SC, const RecurrenceDescriptor &R,
2307- Instruction *I, ArrayRef<VPValue *> Operands,
2308- VPValue *CondOp, bool IsOrdered)
2309- : VPRecipeWithIRFlags(SC, Operands, *I), RdxDesc(R),
2300+ FastMathFlags FMF, Instruction *I,
2301+ ArrayRef<VPValue *> Operands, VPValue *CondOp,
2302+ bool IsOrdered, DebugLoc DL)
2303+ : VPRecipeWithIRFlags(SC, Operands, FMF, DL), RdxDesc(R),
23102304 IsOrdered (IsOrdered) {
23112305 if (CondOp) {
23122306 IsConditional = true ;
23132307 addOperand (CondOp);
23142308 }
2315-
2316- // In-loop reductions may comprise of multiple scalar instructions, and the
2317- // underlying instruction may not contain the same flags as the
2318- // recurrence descriptor, so set the flags explicitly.
2319- if (isa<FPMathOperator>(I))
2320- setFastMathFlags (R.getFastMathFlags ());
2309+ setUnderlyingValue (I);
23212310 }
23222311
23232312public:
23242313 VPReductionRecipe (const RecurrenceDescriptor &R, Instruction *I,
23252314 VPValue *ChainOp, VPValue *VecOp, VPValue *CondOp,
2326- bool IsOrdered)
2327- : VPReductionRecipe(VPDef::VPReductionSC, R, I,
2315+ bool IsOrdered, DebugLoc DL = {} )
2316+ : VPReductionRecipe(VPDef::VPReductionSC, R, R.getFastMathFlags(), I,
23282317 ArrayRef<VPValue *>({ChainOp, VecOp}), CondOp,
2329- IsOrdered) {}
2318+ IsOrdered, DL ) {}
23302319
23312320 ~VPReductionRecipe () override = default ;
23322321
23332322 VPReductionRecipe *clone () override {
23342323 return new VPReductionRecipe (RdxDesc, getUnderlyingInstr (), getChainOp (),
2335- getVecOp (), getCondOp (), IsOrdered);
2324+ getVecOp (), getCondOp (), IsOrdered,
2325+ getDebugLoc ());
23362326 }
23372327
23382328 static inline bool classof (const VPRecipeBase *R) {
@@ -2382,12 +2372,14 @@ class VPReductionRecipe : public VPRecipeWithIRFlags {
23822372// / The Operands are {ChainOp, VecOp, EVL, [Condition]}.
23832373class VPReductionEVLRecipe : public VPReductionRecipe {
23842374public:
2385- VPReductionEVLRecipe (VPReductionRecipe &R, VPValue &EVL, VPValue *CondOp)
2375+ VPReductionEVLRecipe (VPReductionRecipe &R, VPValue &EVL, VPValue *CondOp,
2376+ DebugLoc DL = {})
23862377 : VPReductionRecipe(
23872378 VPDef::VPReductionEVLSC, R.getRecurrenceDescriptor(),
2379+ R.getFastMathFlags(),
23882380 cast_or_null<Instruction>(R.getUnderlyingValue()),
23892381 ArrayRef<VPValue *>({R.getChainOp (), R.getVecOp (), &EVL}), CondOp,
2390- R.isOrdered()) {}
2382+ R.isOrdered(), DL ) {}
23912383
23922384 ~VPReductionEVLRecipe () override = default ;
23932385
0 commit comments