[PATCH] D89087: [MemProf] Pass down memory profile name with optional path from clang

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 17:56:50 PDT 2020


tejohnson created this revision.
tejohnson added a reviewer: davidxl.
Herald added subscribers: wenlei, dang, hiraditya.
Herald added projects: clang, LLVM.
tejohnson requested review of this revision.

Similar to -fprofile-generate=, add -fmemory-profile= which takes a
directory path. This is passed down to LLVM via a new module flag
metadata. LLVM in turn provides this name to the runtime via the new
__memprof_profile_filename variable.

Additionally, always pass a default filename (in $cwd if a directory
name is not specified vi the = form of the option). This is also
consistent with the behavior of the PGO instrumentation. Since the
memory profiles will generally be fairly large, it doesn't make sense to
dump them to stderr. Also, importantly, the memory profiles will
eventually be dumped in a compact binary format, which is another reason
why it does not make sense to send these to stderr by default.

Depends on D89086 <https://reviews.llvm.org/D89086>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89087

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Basic/CodeGenOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/SanitizerArgs.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/memory-profile-filename.c
  clang/test/Driver/fmemprof.cpp
  llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
  llvm/test/Instrumentation/HeapProfiler/filename.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89087.297092.patch
Type: text/x-patch
Size: 11075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201009/08b7f830/attachment.bin>


More information about the llvm-commits mailing list