aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorSlava Zakharin <szakharin@nvidia.com>2022-11-07 09:05:27 -0800
committerSlava Zakharin <szakharin@nvidia.com>2022-11-07 09:26:46 -0800
commit8f3f15c1a208932689a8bdef22d6ca3d4c3408c5 (patch)
tree9706a092f635c9966110478632557745ed163b0f /flang/lib/Frontend/CompilerInvocation.cpp
parentfe2069284d10f78c6472f5934983c5740dea8039 (diff)
downloadllvm-8f3f15c1a208932689a8bdef22d6ca3d4c3408c5.zip
llvm-8f3f15c1a208932689a8bdef22d6ca3d4c3408c5.tar.gz
llvm-8f3f15c1a208932689a8bdef22d6ca3d4c3408c5.tar.bz2
[flang] Configure FirOpBuilder based on math driver options.
Added MathOptionsBase to share fastmath config between different components. Frontend driver translates LangOptions into MathOptionsBase. FirConverter configures FirOpBuilder using MathOptionsBase config passed to it via LoweringOptions. Depends on D137390 Reviewed By: jeanPerier Differential Revision: https://reviews.llvm.org/D137391
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index bb87ea2..f218014 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -944,8 +944,18 @@ void CompilerInvocation::setSemanticsOpts(
/// Set \p loweringOptions controlling lowering behavior based
/// on the \p optimizationLevel.
void CompilerInvocation::setLoweringOptions() {
- const auto &codegenOpts = getCodeGenOpts();
+ const CodeGenOptions &codegenOpts = getCodeGenOpts();
// Lower TRANSPOSE as a runtime call under -O0.
loweringOpts.setOptimizeTranspose(codegenOpts.OptimizationLevel > 0);
+
+ const LangOptions &langOptions = getLangOpts();
+ Fortran::common::MathOptionsBase &mathOpts = loweringOpts.getMathOptions();
+ // TODO: when LangOptions are finalized, we can represent
+ // the math related options using Fortran::commmon::MathOptionsBase,
+ // so that we can just copy it into LoweringOptions.
+ mathOpts
+ .setFPContractEnabled(langOptions.getFPContractMode() ==
+ LangOptions::FPM_Fast)
+ .setNoHonorInfs(langOptions.NoHonorInfs);
}