[PATCH] D85948: [HeapProf] Clang and LLVM support for heap profiling instrumentation

Teresa Johnson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 13 17:13:17 PDT 2020


tejohnson created this revision.
tejohnson added reviewers: vitalybuka, kcc, eugenis, davidxl.
Herald added subscribers: dang, jfb, hiraditya, mgorny.
Herald added projects: clang, LLVM.
tejohnson requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85948

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/include/clang/Driver/SanitizerArgs.h
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Driver/SanitizerArgs.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/Driver/fheapprof.cpp
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/Transforms/Instrumentation/HeapProfiler.h
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/Instrumentation/CMakeLists.txt
  llvm/lib/Transforms/Instrumentation/HeapProfiler.cpp
  llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
  llvm/test/Instrumentation/HeapProfiling/basic.ll
  llvm/test/Instrumentation/HeapProfiling/instrumentation-use-callbacks.ll
  llvm/test/Instrumentation/HeapProfiling/masked-load-store.ll
  llvm/test/Instrumentation/HeapProfiling/scale-granularity.ll
  llvm/test/Instrumentation/HeapProfiling/version-mismatch-check.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85948.285527.patch
Type: text/x-patch
Size: 65693 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200814/f32db73f/attachment-0001.bin>


More information about the cfe-commits mailing list