diff options
author | Slava Zakharin <szakharin@nvidia.com> | 2022-07-19 20:39:58 -0700 |
---|---|---|
committer | Slava Zakharin <szakharin@nvidia.com> | 2022-08-05 11:29:45 -0700 |
commit | f1eb945f9a5037b1fac6da02405047b24c0c2de5 (patch) | |
tree | 65fe255cbe27f7b8ac2ececf5cbc1f91f0ed6935 /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | 9c81b743e31a7dca288b37b6cf6cca3213bfd923 (diff) | |
download | llvm-f1eb945f9a5037b1fac6da02405047b24c0c2de5.zip llvm-f1eb945f9a5037b1fac6da02405047b24c0c2de5.tar.gz llvm-f1eb945f9a5037b1fac6da02405047b24c0c2de5.tar.bz2 |
[flang] Propagate lowering options from driver.
This commit addresses concerns raised in D129497.
Propagate lowering options from driver to expressions lowering
via AbstractConverter instance. A single use case so far is
using optimized TRANSPOSE lowering with O1/O2/O3.
bbc does not support optimization level switches, so it uses
default LoweringOptions (e.g. optimized TRANSPOSE lowering
is enabled by default, but an engineering -opt-transpose=false
option can still override this).
Differential Revision: https://reviews.llvm.org/D130204
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | flang/lib/Frontend/CompilerInvocation.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index f794eb7..a75c04d 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -794,3 +794,12 @@ void CompilerInvocation::setSemanticsOpts( .set_warningsAreErrors(getWarnAsErr()) .set_moduleFileSuffix(getModuleFileSuffix()); } + +/// Set \p loweringOptions controlling lowering behavior based +/// on the \p optimizationLevel. +void CompilerInvocation::setLoweringOptions() { + const auto &codegenOpts = getCodeGenOpts(); + + // Lower TRANSPOSE as a runtime call under -O0. + loweringOpts.setOptimizeTranspose(codegenOpts.OptimizationLevel > 0); +} |