This patch updates VPReductionRecipe::execute so that the fast-math
flags associated with the underlying instruction of the VPReductionRecipe are
propagated through to the reductions which are created.
Depends on D112547
Paths 
  |  Differential  D112548  
[LoopVectorize] Propagate fast-math flags for inloop reductions ClosedPublic Authored by RosieSumpter on Oct 26 2021, 8:15 AM. 
Details Summary This patch updates VPReductionRecipe::execute so that the fast-math Depends on D112547 
Diff Detail Event TimelineComment Actions Thanks for this patch @RosieSumpter - seems like a nice fix! I wonder if it's also worth changing createOrderedReduction to be similar to createTargetReduction and set the flags in there too? Also, you've fixed up the VF=1 cases too. 
 RosieSumpter added a parent revision: D112547: [LoopVectorize] Clean up VPReductionRecipe::execute. NFC. RosieSumpter added a child revision: D111555: [LoopVectorize] Add vector reduction support for fmuladd intrinsic. RosieSumpter retitled this revision from [LoopVectorize] Propagate fast-math flags for ordered reductions to [LoopVectorize] Propagate fast-math flags for inloop reductions. Comment Actions
 Comment Actions Thank you @RosieSumpter, this patch looks good to me and I think all of the comments have been addressed. 
 This revision is now accepted and ready to land.Oct 28 2021, 9:01 AM 
 
 Comment Actions Just adding an extra datapoint to do with as you wish. 
 
 Closed by commit rGdcb8222d8777: [LoopVectorize] Propagate fast-math flags for inloop reductions (authored by RosieSumpter).  ·  Explain WhyNov 2 2021, 2:04 AM This revision was automatically updated to reflect the committed changes. 
Revision Contents 
 
 
Diff 383031 llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
 
 llvm/test/Transforms/LoopVectorize/AArch64/strict-fadd.ll
 llvm/test/Transforms/LoopVectorize/reduction-inloop-pred.ll
 llvm/test/Transforms/LoopVectorize/reduction-inloop.ll
  | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I completely forgot we can actually just use a guard here, i.e.
then you don't need the extra line at the bottom anymore to reset the flags.