[all-commits] [llvm/llvm-project] 0949f9: [MemProf] Pass down memory profile name with optio...

Teresa Johnson via All-commits all-commits at lists.llvm.org
Sun Nov 1 17:39:05 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 0949f96dc6521be80ebb8ebc1e1c506165c22aac
      https://github.com/llvm/llvm-project/commit/0949f96dc6521be80ebb8ebc1e1c506165c22aac
  Author: Teresa Johnson <tejohnson at google.com>
  Date:   2020-11-01 (Sun, 01 Nov 2020)

  Changed paths:
    M clang/include/clang/Basic/CodeGenOptions.def
    M clang/include/clang/Basic/CodeGenOptions.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Driver/SanitizerArgs.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    A clang/test/CodeGen/memory-profile-filename.c
    M clang/test/Driver/fmemprof.cpp
    M compiler-rt/test/memprof/TestCases/atexit_stats.cpp
    M compiler-rt/test/memprof/TestCases/dump_process_map.cpp
    M compiler-rt/test/memprof/TestCases/log_path_test.cpp
    M compiler-rt/test/memprof/TestCases/malloc-size-too-big.cpp
    M compiler-rt/test/memprof/TestCases/mem_info_cache_entries.cpp
    M compiler-rt/test/memprof/TestCases/print_miss_rate.cpp
    M compiler-rt/test/memprof/TestCases/stress_dtls.c
    M compiler-rt/test/memprof/TestCases/test_malloc_load_store.c
    M compiler-rt/test/memprof/TestCases/test_memintrin.cpp
    M compiler-rt/test/memprof/TestCases/test_new_load_store.cpp
    M compiler-rt/test/memprof/TestCases/test_terse.cpp
    M compiler-rt/test/memprof/TestCases/unaligned_loads_and_stores.cpp
    M llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
    A llvm/test/Instrumentation/HeapProfiler/filename.ll

  Log Message:
  -----------
  [MemProf] Pass down memory profile name with optional path from clang

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.

Change the existing memprof tests to specify log_path=stderr when that
was being relied on.

Depends on D89086.

Differential Revision: https://reviews.llvm.org/D89087




More information about the All-commits mailing list