diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2019-03-12 01:31:44 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2019-03-12 01:31:44 +0000 |
commit | 3f5ce18658f0b6cc01853a02aede777d190ee52d (patch) | |
tree | 8585f01ca8bba472cf5b3bee143b3d87a74fc557 /llvm/lib/CodeGen | |
parent | 3751ae4a94379d572cc722ee0beac8019241f5d4 (diff) | |
download | bcm5719-llvm-3f5ce18658f0b6cc01853a02aede777d190ee52d.tar.gz bcm5719-llvm-3f5ce18658f0b6cc01853a02aede777d190ee52d.zip |
Reland "Relax constraints for reduction vectorization"
Change from original commit: move test (that uses an X86 triple) into the X86
subdirectory.
Original description:
Gating vectorizing reductions on *all* fastmath flags seems unnecessary;
`reassoc` should be sufficient.
Reviewers: tvvikram, mkuper, kristof.beyls, sdesmalen, Ayal
Reviewed By: sdesmalen
Subscribers: dcaballe, huntergr, jmolloy, mcrosier, jlebar, bixia, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D57728
llvm-svn: 355889
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/ExpandReductions.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/ExpandReductions.cpp b/llvm/lib/CodeGen/ExpandReductions.cpp index f44d89156b6..34858883298 100644 --- a/llvm/lib/CodeGen/ExpandReductions.cpp +++ b/llvm/lib/CodeGen/ExpandReductions.cpp @@ -118,9 +118,11 @@ bool expandReductions(Function &F, const TargetTransformInfo *TTI) { } if (!TTI->shouldExpandReduction(II)) continue; + FastMathFlags FMF = + isa<FPMathOperator>(II) ? II->getFastMathFlags() : FastMathFlags{}; Value *Rdx = IsOrdered ? getOrderedReduction(Builder, Acc, Vec, getOpcode(ID), MRK) - : getShuffleReduction(Builder, Vec, getOpcode(ID), MRK); + : getShuffleReduction(Builder, Vec, getOpcode(ID), MRK, FMF); II->replaceAllUsesWith(Rdx); II->eraseFromParent(); Changed = true; |