summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaAttr.cpp
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2017-03-29 21:54:24 +0000
committerAdam Nemet <anemet@apple.com>2017-03-29 21:54:24 +0000
commit049a31d53da5321b5adb78ac1fb6dc305a836ffd (patch)
tree0e2a3c033aa407a6336d0409c3fd6fc686c384e7 /clang/lib/Sema/SemaAttr.cpp
parenta79b8a22b4dcbd049837da4005e898c226e1ece4 (diff)
downloadbcm5719-llvm-049a31d53da5321b5adb78ac1fb6dc305a836ffd.tar.gz
bcm5719-llvm-049a31d53da5321b5adb78ac1fb6dc305a836ffd.zip
Use FPContractModeKind universally
FPContractModeKind is the codegen option flag which is already ternary (off, on, fast). This makes it universally the type for the contractable info across the front-end: * In FPOptions (i.e. in the Sema + in the expression nodes). * In LangOpts::DefaultFPContractMode which is the option that initializes FPOptions in the Sema. Another way to look at this change is that before fp-contractable on/off were the only states handled to the front-end: * For "on", FMA folding was performed by the front-end * For "fast", we simply forwarded the flag to TargetOptions to handle it in LLVM Now off/on/fast are all exposed because for fast we will generate fast-math-flags during CodeGen. This is toward moving fp-contraction=fast from an LLVM TargetOption to a FastMathFlag in order to fix PR25721. --- This is a recommit of r299027 with an adjustment to the test CodeGenCUDA/fp-contract.cu. The test assumed that even though -ffp-contract=on is passed FE-based folding of FMA won't happen. This is obviously wrong since the user is asking for this explicitly with the option. CUDA is different that -ffp-contract=fast is on by default. The test used to "work" because contract=fast and contract=on were maintained separately and we didn't fold in the FE because contract=fast was on due to the target-default. This patch consolidates the contract=on/fast/off state into a ternary state hence the change in behavior. --- Differential Revision: https://reviews.llvm.org/D31167 llvm-svn: 299033
Diffstat (limited to 'clang/lib/Sema/SemaAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaAttr.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaAttr.cpp b/clang/lib/Sema/SemaAttr.cpp
index 992eac9019f..34744cbdd99 100644
--- a/clang/lib/Sema/SemaAttr.cpp
+++ b/clang/lib/Sema/SemaAttr.cpp
@@ -450,13 +450,16 @@ void Sema::ActOnPragmaVisibility(const IdentifierInfo* VisType,
void Sema::ActOnPragmaFPContract(tok::OnOffSwitch OOS) {
switch (OOS) {
case tok::OOS_ON:
- FPFeatures.setFPContractable(true);
+ FPFeatures.setAllowFPContractWithinStatement();
break;
case tok::OOS_OFF:
- FPFeatures.setFPContractable(false);
+ FPFeatures.setDisallowFPContract();
break;
case tok::OOS_DEFAULT:
- FPFeatures.setFPContractable(getLangOpts().DefaultFPContract);
+ if (getLangOpts().getDefaultFPContractMode() == LangOptions::FPC_On)
+ FPFeatures.setAllowFPContractWithinStatement();
+ else
+ FPFeatures.setDisallowFPContract();
break;
}
}
OpenPOWER on IntegriCloud