aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorTom Eccles <tom.eccles@arm.com>2023-12-04 15:28:15 +0000
committerGitHub <noreply@github.com>2023-12-04 15:28:15 +0000
commit374e8288e047da640090629879072e4fa3af31fe (patch)
treefb509cf78b49a17d58ff8aa49033189c4eaecdbe /flang/lib/Frontend/CompilerInvocation.cpp
parentc274eea297417fff223fc6aaf9aa578ce4e5696a (diff)
downloadllvm-374e8288e047da640090629879072e4fa3af31fe.zip
llvm-374e8288e047da640090629879072e4fa3af31fe.tar.gz
llvm-374e8288e047da640090629879072e4fa3af31fe.tar.bz2
[flang] (Re-)Enable alias tags pass by default (#74250)
Enable by default for optimization levels higher than 0 (same behavior as clang). For simplicity, only forward the flag to the frontend driver when it contradicts what is implied by the optimization level. This was first landed in https://github.com/llvm/llvm-project/pull/73111 but was later reverted due to a performance regression. That regression was fixed by https://github.com/llvm/llvm-project/pull/74065.
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index e7730d5..ec04727 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -242,10 +242,12 @@ static void parseCodeGenArgs(Fortran::frontend::CodeGenOptions &opts,
clang::driver::options::OPT_fno_loop_versioning, false))
opts.LoopVersioning = 1;
- opts.AliasAnalysis =
- args.hasFlag(clang::driver::options::OPT_falias_analysis,
- clang::driver::options::OPT_fno_alias_analysis,
- /*default=*/false);
+ opts.AliasAnalysis = opts.OptimizationLevel > 0;
+ if (auto *arg =
+ args.getLastArg(clang::driver::options::OPT_falias_analysis,
+ clang::driver::options::OPT_fno_alias_analysis))
+ opts.AliasAnalysis =
+ arg->getOption().matches(clang::driver::options::OPT_falias_analysis);
for (auto *a : args.filtered(clang::driver::options::OPT_fpass_plugin_EQ))
opts.LLVMPassPlugins.push_back(a->getValue());