aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2020-09-12 14:23:36 +0100
committerFlorian Hahn <flo@fhahn.com>2020-09-12 14:56:13 +0100
commita874d63344093752c912d01de60211f65745ea6f (patch)
tree1af7a9221b4586b540e96968fabfed447d658872 /clang/lib/Frontend/CompilerInvocation.cpp
parent2e61cd1295e0031b2379af2b65373e2798a551cb (diff)
downloadllvm-a874d63344093752c912d01de60211f65745ea6f.zip
llvm-a874d63344093752c912d01de60211f65745ea6f.tar.gz
llvm-a874d63344093752c912d01de60211f65745ea6f.tar.bz2
[Clang] Add option to allow marking pass-by-value args as noalias.
After the recent discussion on cfe-dev 'Can indirect class parameters be noalias?' [1], it seems like using using noalias is problematic for current C++, but should be allowed for C-only code. This patch introduces a new option to let the user indicate that it is safe to mark indirect class parameters as noalias. Note that this also applies to external callers, e.g. it might not be safe to use this flag for C functions that are called by C++ functions. In targets that allocate indirect arguments in the called function, this enables more agressive optimizations with respect to memory operations and brings a ~1% - 2% codesize reduction for some programs. [1] : http://lists.llvm.org/pipermail/cfe-dev/2020-July/066353.html Reviewed By: rjmccall Differential Revision: https://reviews.llvm.org/D85473
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index fbccff1..0d8b0f9 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1453,6 +1453,8 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
std::string(Args.getLastArgValue(OPT_fsymbol_partition_EQ));
Opts.ForceAAPCSBitfieldLoad = Args.hasArg(OPT_ForceAAPCSBitfieldLoad);
+
+ Opts.PassByValueIsNoAlias = Args.hasArg(OPT_fpass_by_value_is_noalias);
return Success;
}