aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorSjoerd Meijer <smeijer@nvidia.com>2025-02-07 10:31:24 +0000
committerGitHub <noreply@github.com>2025-02-07 10:31:24 +0000
commit612df14c0058572c876f59d41ec56c89710cee15 (patch)
tree410009b9d9c9f96a06e84175d6e0d8fa719576b1 /clang/lib/Frontend/CompilerInvocation.cpp
parent52db30ec4154b0ef21db546ed9b5a9bfe47859cd (diff)
downloadllvm-612df14c0058572c876f59d41ec56c89710cee15.zip
llvm-612df14c0058572c876f59d41ec56c89710cee15.tar.gz
llvm-612df14c0058572c876f59d41ec56c89710cee15.tar.bz2
[Clang][Driver] Add an option to control loop-interchange (#125830)
This introduces options `-floop-interchange` and `-fno-loop-interchange` to enable/disable the loop-interchange pass. This is part of the work that tries to get that pass enabled by default (#124911), where it was remarked that a user facing option to control this would be convenient to have. The option name is the same as GCC's.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 8b1bbf1..014e629 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1665,6 +1665,11 @@ void CompilerInvocationBase::GenerateCodeGenArgs(const CodeGenOptions &Opts,
else if (!Opts.UnrollLoops && Opts.OptimizationLevel > 1)
GenerateArg(Consumer, OPT_fno_unroll_loops);
+ if (Opts.InterchangeLoops)
+ GenerateArg(Consumer, OPT_floop_interchange);
+ else
+ GenerateArg(Consumer, OPT_fno_loop_interchange);
+
if (!Opts.BinutilsVersion.empty())
GenerateArg(Consumer, OPT_fbinutils_version_EQ, Opts.BinutilsVersion);
@@ -1971,6 +1976,8 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
Opts.UnrollLoops =
Args.hasFlag(OPT_funroll_loops, OPT_fno_unroll_loops,
(Opts.OptimizationLevel > 1));
+ Opts.InterchangeLoops =
+ Args.hasFlag(OPT_floop_interchange, OPT_fno_loop_interchange, false);
Opts.BinutilsVersion =
std::string(Args.getLastArgValue(OPT_fbinutils_version_EQ));