diff options
author | Slava Zakharin <szakharin@nvidia.com> | 2022-11-07 09:05:27 -0800 |
---|---|---|
committer | Slava Zakharin <szakharin@nvidia.com> | 2022-11-07 09:26:46 -0800 |
commit | 8f3f15c1a208932689a8bdef22d6ca3d4c3408c5 (patch) | |
tree | 9706a092f635c9966110478632557745ed163b0f /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | fe2069284d10f78c6472f5934983c5740dea8039 (diff) | |
download | llvm-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.cpp | 12 |
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); } |