[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
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user