aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorMelanie Blower <melanie.blower@intel.com>2020-06-26 07:48:38 -0700
committerMelanie Blower <melanie.blower@intel.com>2020-06-26 07:52:57 -0700
commitb55d723ed61052b77e720dcffecac43abe873186 (patch)
tree2a1e34f05d7baf5fc115f34e5b04dc8cba6d775a /clang/lib/CodeGen/CodeGenFunction.cpp
parentfa1b488776185827274637f8fdd38b20b6b5c036 (diff)
downloadllvm-b55d723ed61052b77e720dcffecac43abe873186.zip
llvm-b55d723ed61052b77e720dcffecac43abe873186.tar.gz
llvm-b55d723ed61052b77e720dcffecac43abe873186.tar.bz2
Revert "Modify FPFeatures to use delta not absolute settings"
This reverts commit 3a748cbf86cea3844fada04eeff4cc64b01f67e0. I'm reverting this commit because I forgot to format the commit message propertly. Sorry for the thrash.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index cfd32d1..23208b2d 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -117,12 +117,12 @@ void CodeGenFunction::SetFPModel() {
void CodeGenFunction::SetFastMathFlags(FPOptions FPFeatures) {
llvm::FastMathFlags FMF;
- FMF.setAllowReassoc(FPFeatures.getAllowFPReassociate());
- FMF.setNoNaNs(FPFeatures.getNoHonorNaNs());
- FMF.setNoInfs(FPFeatures.getNoHonorInfs());
- FMF.setNoSignedZeros(FPFeatures.getNoSignedZero());
- FMF.setAllowReciprocal(FPFeatures.getAllowReciprocal());
- FMF.setApproxFunc(FPFeatures.getAllowApproxFunc());
+ FMF.setAllowReassoc(FPFeatures.allowAssociativeMath());
+ FMF.setNoNaNs(FPFeatures.noHonorNaNs());
+ FMF.setNoInfs(FPFeatures.noHonorInfs());
+ FMF.setNoSignedZeros(FPFeatures.noSignedZeros());
+ FMF.setAllowReciprocal(FPFeatures.allowReciprocalMath());
+ FMF.setApproxFunc(FPFeatures.allowApproximateFunctions());
FMF.setAllowContract(FPFeatures.allowFPContractAcrossStatement());
Builder.setFastMathFlags(FMF);
}
@@ -137,12 +137,10 @@ CodeGenFunction::CGFPOptionsRAII::CGFPOptionsRAII(CodeGenFunction &CGF,
FMFGuard.emplace(CGF.Builder);
- llvm::RoundingMode NewRoundingBehavior =
- static_cast<llvm::RoundingMode>(FPFeatures.getRoundingMode());
+ auto NewRoundingBehavior = FPFeatures.getRoundingMode();
CGF.Builder.setDefaultConstrainedRounding(NewRoundingBehavior);
auto NewExceptionBehavior =
- ToConstrainedExceptMD(static_cast<LangOptions::FPExceptionModeKind>(
- FPFeatures.getFPExceptionMode()));
+ ToConstrainedExceptMD(FPFeatures.getExceptionMode());
CGF.Builder.setDefaultConstrainedExcept(NewExceptionBehavior);
CGF.SetFastMathFlags(FPFeatures);
@@ -161,13 +159,13 @@ CodeGenFunction::CGFPOptionsRAII::CGFPOptionsRAII(CodeGenFunction &CGF,
if (OldValue != NewValue)
CGF.CurFn->addFnAttr(Name, llvm::toStringRef(NewValue));
};
- mergeFnAttrValue("no-infs-fp-math", FPFeatures.getNoHonorInfs());
- mergeFnAttrValue("no-nans-fp-math", FPFeatures.getNoHonorNaNs());
- mergeFnAttrValue("no-signed-zeros-fp-math", FPFeatures.getNoSignedZero());
- mergeFnAttrValue("unsafe-fp-math", FPFeatures.getAllowFPReassociate() &&
- FPFeatures.getAllowReciprocal() &&
- FPFeatures.getAllowApproxFunc() &&
- FPFeatures.getNoSignedZero());
+ mergeFnAttrValue("no-infs-fp-math", FPFeatures.noHonorInfs());
+ mergeFnAttrValue("no-nans-fp-math", FPFeatures.noHonorNaNs());
+ mergeFnAttrValue("no-signed-zeros-fp-math", FPFeatures.noSignedZeros());
+ mergeFnAttrValue(
+ "unsafe-fp-math",
+ FPFeatures.allowAssociativeMath() && FPFeatures.allowReciprocalMath() &&
+ FPFeatures.allowApproximateFunctions() && FPFeatures.noSignedZeros());
}
CodeGenFunction::CGFPOptionsRAII::~CGFPOptionsRAII() {