Page MenuHomePhabricator

[MemProf] Pass down memory profile name with optional path from clang
Needs ReviewPublic

Authored by tejohnson on Thu, Oct 8, 5:56 PM.

Details

Reviewers
davidxl
Summary

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.

Diff Detail

Unit TestsFailed

TimeTest
380 mswindows > Clang.CodeGen::memory-profile-filename.c
Script: -- : 'RUN: at line 3'; c:\ws\w16-1\llvm-project\premerge-checks\build\bin\clang.exe -target x86_64-linux-gnu -S -emit-llvm -o - C:\ws\w16-1\llvm-project\premerge-checks\clang\test\CodeGen\memory-profile-filename.c | c:\ws\w16-1\llvm-project\premerge-checks\build\bin\filecheck.exe C:\ws\w16-1\llvm-project\premerge-checks\clang\test\CodeGen\memory-profile-filename.c --check-prefix=NONE

Event Timeline

tejohnson created this revision.Thu, Oct 8, 5:56 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptThu, Oct 8, 5:56 PM
tejohnson requested review of this revision.Thu, Oct 8, 5:56 PM

As discussed in review for D89086, move test changes to this patch since they are only required here.

Herald added a project: Restricted Project. · View Herald TranscriptSat, Oct 17, 12:50 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript