This will allow the output directory to be specified by a build time
option, similar to the directory specified for regular PGO profiles via
-fprofile-generate=. The memory profiling instrumentation pass will
set up the variable. This is the same mechanism used by the PGO
instrumentation and runtime.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Profile runtime has 4 ways of setting output: 1) default 2) compiler command line arg 3) environment variable at runtime; and 4) user invocation of runtime API at runtime. The order of the precedence is 4> 3 > 2 > 1. Is the behavior here consistent with that?
LGTM but I have no opinion on David's request.
compiler-rt/lib/memprof/memprof_rtl.cpp | ||
---|---|---|
31 | not needed? | |
compiler-rt/lib/sanitizer_common/sanitizer_file.cpp | ||
71–92 ↗ | (On Diff #297091) | looks correct, but it would be nice to have sanitizer_common as a separate patch |
compiler-rt/test/memprof/TestCases/atexit_stats.cpp | ||
4 ↗ | (On Diff #297091) | It's not clear why this is needed before reading patch description. |
The runtime I recently upstreamed has #3, and this patch adds #1 (well there is a default in the already upstreamed stuff, but it is stderr) and #2. A follow on patch will add #4. The order of precedence will be the same as in the profile runtime (it is already 3>2>1).
compiler-rt/lib/memprof/memprof_rtl.cpp | ||
---|---|---|
31 | This is to ensure that the if below at line 182 will fail when the compiler has not set up a strong version of this variable. | |
compiler-rt/lib/sanitizer_common/sanitizer_file.cpp | ||
71–92 ↗ | (On Diff #297091) | Ok, I can split this out. |
compiler-rt/test/memprof/TestCases/atexit_stats.cpp | ||
4 ↗ | (On Diff #297091) | I can just move this to the follow on patch that changes the compiler which affects the defaults, requiring this change. |
compiler-rt/lib/memprof/memprof_rtl.cpp | ||
---|---|---|
31 | Sorry, I asked if initialization is needed. "={0}" I'd expect it's already zeroes. |
compiler-rt/lib/memprof/memprof_rtl.cpp | ||
---|---|---|
31 | You're right. The global should get zero initialized so the init isn't really necessary. I can remove it. |
not needed?