@@ -788,13 +788,6 @@ class VPRecipeWithIRFlags : public VPSingleDefRecipe {
788788 }
789789 }
790790
791- // / Set fast-math flags for this recipe.
792- void setFastMathFlags (FastMathFlags FMFs) {
793- assert (OpType == OperationType::FPMathOp &&
794- " We should only set the FastMathFlags when the recipes is FPFathOP" );
795- this ->FMFs = FMFs;
796- }
797-
798791 CmpInst::Predicate getPredicate () const {
799792 assert (OpType == OperationType::Cmp &&
800793 " recipe doesn't have a compare predicate" );
@@ -2254,35 +2247,32 @@ class VPReductionRecipe : public VPRecipeWithIRFlags {
22542247
22552248protected:
22562249 VPReductionRecipe (const unsigned char SC, const RecurrenceDescriptor &R,
2257- Instruction *I, ArrayRef<VPValue *> Operands,
2258- VPValue *CondOp, bool IsOrdered)
2259- : VPRecipeWithIRFlags(SC, Operands, *I), RdxDesc(R),
2250+ FastMathFlags FMF, Instruction *I,
2251+ ArrayRef<VPValue *> Operands, VPValue *CondOp,
2252+ bool IsOrdered, DebugLoc DL)
2253+ : VPRecipeWithIRFlags(SC, Operands, FMF, DL), RdxDesc(R),
22602254 IsOrdered (IsOrdered) {
22612255 if (CondOp) {
22622256 IsConditional = true ;
22632257 addOperand (CondOp);
22642258 }
2265-
2266- // In-loop reductions may comprise of multiple scalar instructions, and the
2267- // underlying instruction may not contain the same flags as the
2268- // recurrence descriptor, so set the flags explicitly.
2269- if (isa<FPMathOperator>(I))
2270- setFastMathFlags (R.getFastMathFlags ());
2259+ setUnderlyingValue (I);
22712260 }
22722261
22732262public:
22742263 VPReductionRecipe (const RecurrenceDescriptor &R, Instruction *I,
22752264 VPValue *ChainOp, VPValue *VecOp, VPValue *CondOp,
2276- bool IsOrdered)
2277- : VPReductionRecipe(VPDef::VPReductionSC, R, I,
2265+ bool IsOrdered, DebugLoc DL = {} )
2266+ : VPReductionRecipe(VPDef::VPReductionSC, R, R.getFastMathFlags(), I,
22782267 ArrayRef<VPValue *>({ChainOp, VecOp}), CondOp,
2279- IsOrdered) {}
2268+ IsOrdered, DL ) {}
22802269
22812270 ~VPReductionRecipe () override = default ;
22822271
22832272 VPReductionRecipe *clone () override {
22842273 return new VPReductionRecipe (RdxDesc, getUnderlyingInstr (), getChainOp (),
2285- getVecOp (), getCondOp (), IsOrdered);
2274+ getVecOp (), getCondOp (), IsOrdered,
2275+ getDebugLoc ());
22862276 }
22872277
22882278 static inline bool classof (const VPRecipeBase *R) {
@@ -2332,12 +2322,14 @@ class VPReductionRecipe : public VPRecipeWithIRFlags {
23322322// / The Operands are {ChainOp, VecOp, EVL, [Condition]}.
23332323class VPReductionEVLRecipe : public VPReductionRecipe {
23342324public:
2335- VPReductionEVLRecipe (VPReductionRecipe &R, VPValue &EVL, VPValue *CondOp)
2325+ VPReductionEVLRecipe (VPReductionRecipe &R, VPValue &EVL, VPValue *CondOp,
2326+ DebugLoc DL = {})
23362327 : VPReductionRecipe(
23372328 VPDef::VPReductionEVLSC, R.getRecurrenceDescriptor(),
2329+ R.getFastMathFlags(),
23382330 cast_or_null<Instruction>(R.getUnderlyingValue()),
23392331 ArrayRef<VPValue *>({R.getChainOp (), R.getVecOp (), &EVL}), CondOp,
2340- R.isOrdered()) {}
2332+ R.isOrdered(), DL ) {}
23412333
23422334 ~VPReductionEVLRecipe () override = default ;
23432335
0 commit comments