aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopUtils.cpp
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2015-09-21 19:41:19 +0000
committerJames Molloy <james.molloy@arm.com>2015-09-21 19:41:19 +0000
commit50a4c27f97bb86b1c255da63a7d598dcc495a19c (patch)
treea5c10383d0033095047efbc0f948a42714e43d98 /llvm/lib/Transforms/Utils/LoopUtils.cpp
parentf16f649e0dd33944ecbd27085596ae25d88d65bb (diff)
downloadllvm-50a4c27f97bb86b1c255da63a7d598dcc495a19c.zip
llvm-50a4c27f97bb86b1c255da63a7d598dcc495a19c.tar.gz
llvm-50a4c27f97bb86b1c255da63a7d598dcc495a19c.tar.bz2
[LoopUtils,LV] Propagate fast-math flags on generated FCmp instructions
We're currently losing any fast-math flags when synthesizing fcmps for min/max reductions. In LV, make sure we copy over the scalar inst's flags. In LoopUtils, we know we only ever match patterns with hasUnsafeAlgebra, so apply that to any synthesized ops. llvm-svn: 248201
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUtils.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index a8d20c6..56b9084 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -594,6 +594,13 @@ Value *RecurrenceDescriptor::createMinMaxOp(IRBuilder<> &Builder,
break;
}
+ // We only match FP sequences with unsafe algebra, so we can unconditionally
+ // set it on any generated instructions.
+ IRBuilder<>::FastMathFlagGuard FMFG(Builder);
+ FastMathFlags FMF;
+ FMF.setUnsafeAlgebra();
+ Builder.SetFastMathFlags(FMF);
+
Value *Cmp;
if (RK == MRK_FloatMin || RK == MRK_FloatMax)
Cmp = Builder.CreateFCmp(P, Left, Right, "rdx.minmax.cmp");