summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2017-03-29 21:24:19 +0000
committerAdam Nemet <anemet@apple.com>2017-03-29 21:24:19 +0000
commite940f358c8e90067981a1fdca20b9b59690d63bd (patch)
treea1b1f9d1e5a7ce547c2aac3b268909ec71ef524d /clang/lib/CodeGen
parent01a28ca7f8f0999527ffa2d86f6e77b374ef1ed6 (diff)
downloadbcm5719-llvm-e940f358c8e90067981a1fdca20b9b59690d63bd.tar.gz
bcm5719-llvm-e940f358c8e90067981a1fdca20b9b59690d63bd.zip
Revert "Use FPContractModeKind universally"
This reverts commit r299027. It's causing a test failure in clang's CodeGenCUDE/fp-contract.cu llvm-svn: 299029
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/BackendUtil.cpp8
-rw-r--r--clang/lib/CodeGen/CGExprScalar.cpp7
2 files changed, 10 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index f34c8cabc69..35de1a4580e 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -561,14 +561,14 @@ void EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) {
.Default(llvm::FloatABI::Default);
// Set FP fusion mode.
- switch (LangOpts.getDefaultFPContractMode()) {
- case LangOptions::FPC_Off:
+ switch (CodeGenOpts.getFPContractMode()) {
+ case CodeGenOptions::FPC_Off:
Options.AllowFPOpFusion = llvm::FPOpFusion::Strict;
break;
- case LangOptions::FPC_On:
+ case CodeGenOptions::FPC_On:
Options.AllowFPOpFusion = llvm::FPOpFusion::Standard;
break;
- case LangOptions::FPC_Fast:
+ case CodeGenOptions::FPC_Fast:
Options.AllowFPOpFusion = llvm::FPOpFusion::Fast;
break;
}
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index e9041b282fb..9eb21b8086f 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -2672,7 +2672,12 @@ static Value* tryEmitFMulAdd(const BinOpInfo &op,
"Only fadd/fsub can be the root of an fmuladd.");
// Check whether this op is marked as fusable.
- if (!op.FPFeatures.allowFPContractWithinStatement())
+ if (!op.FPFeatures.isFPContractable())
+ return nullptr;
+
+ // Check whether -ffp-contract=on. (If -ffp-contract=off/fast, fusing is
+ // either disabled, or handled entirely by the LLVM backend).
+ if (CGF.CGM.getCodeGenOpts().getFPContractMode() != CodeGenOptions::FPC_On)
return nullptr;
// We have a potentially fusable op. Look for a mul on one of the operands.
OpenPOWER on IntegriCloud