aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2020-08-13 16:29:38 -0700
committerTeresa Johnson <tejohnson@google.com>2020-08-27 08:50:35 -0700
commit7ed8124d46f94601d5f1364becee9cee8538265e (patch)
tree5e0f57bc5a06e51205ffaee9696b301e1121a587 /clang/lib/Frontend/CompilerInvocation.cpp
parenta19fd1aab519ccec18654f76a01b0345880c5200 (diff)
downloadllvm-7ed8124d46f94601d5f1364becee9cee8538265e.zip
llvm-7ed8124d46f94601d5f1364becee9cee8538265e.tar.gz
llvm-7ed8124d46f94601d5f1364becee9cee8538265e.tar.bz2
[HeapProf] Clang and LLVM support for heap profiling instrumentation
See RFC for background: http://lists.llvm.org/pipermail/llvm-dev/2020-June/142744.html Note that the runtime changes will be sent separately (hopefully this week, need to add some tests). This patch includes the LLVM pass to instrument memory accesses with either inline sequences to increment the access count in the shadow location, or alternatively to call into the runtime. It also changes calls to memset/memcpy/memmove to the equivalent runtime version. The pass is modeled on the address sanitizer pass. The clang changes add the driver option to invoke the new pass, and to link with the upcoming heap profiling runtime libraries. Currently there is no attempt to optimize the instrumentation, e.g. to aggregate updates to the same memory allocation. That will be implemented as follow on work. Differential Revision: https://reviews.llvm.org/D85948
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 89dce75..1cd392f 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1033,6 +1033,8 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Opts.ThinLinkBitcodeFile =
std::string(Args.getLastArgValue(OPT_fthin_link_bitcode_EQ));
+ Opts.HeapProf = Args.hasArg(OPT_fmemprof);
+
Opts.MSVolatile = Args.hasArg(OPT_fms_volatile);
Opts.VectorizeLoop = Args.hasArg(OPT_vectorize_loops);