This disable the memprof tests on gcc since allocation sites are affected by
optimizations. Adopted from the approach in
compiler-rt/test/asan/TestCases/heap-overflow.cpp
Example failure: https://lab.llvm.org/buildbot/#/builders/247/builds/2185
Differential D145428
[memprof] Restrict memprof profile generation to clang only. snehasish on Mar 6 2023, 2:23 PM. Authored by
Details
This disable the memprof tests on gcc since allocation sites are affected by Example failure: https://lab.llvm.org/buildbot/#/builders/247/builds/2185
Diff Detail
Event TimelineComment Actions I'm not sure I understand what is happening - presumably gcc is being used to build clang and compiler-rt. How is that affecting the allocation sites? Comment Actions I assumed it was due to optimizations however after looking more closely, the behaviour is due to a difference in debug information for the compiler-rt runtime. For the basic test case with the code below -- #include <stdlib.h> #include <string.h> int main(int argc, char **argv) { char *x = (char *)malloc(10); memset(x, 0, 10); free(x); x = (char *)malloc(10); memset(x, 0, 10); free(x); return 0; } In both gcc and clang, we record 4 allocation sites. However two of them are from the application and two of them are from the runtime only [1]. We filter the records and drop frames which are from the runtime using the check here [2]. For gcc, this check fails since the path is just the filename memprof_malloc_linux.cpp as opposed to compiler-rt/lib/memprof/memprof_malloc_linux.cpp when built with clang. The isRuntime check looks for memprof/memprof_*. This seems to be an artifact of how the runtime was compiled in this environment and perhaps we can make this check more robust by listing the runtime filenames directly? [1] https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/memprof/memprof_malloc_linux.cpp#L58 Comment Actions Also looking into why we have these extra interceptions, it looks like we set memprof_init_is_running to false and a subsequent call to Symbolizer::LateInitialize is intercepted [1]. [1] https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/memprof/memprof_rtl.cpp#L201-L217 Comment Actions Yeah, that seems like the best option.
I don't recall why we set this to false at this specific point, it seems like it should be ok to delay it. And then I wonder if we can combine memprof_init_is_running with memprof_init_done? Comment Actions
Delaying it seems to be fine on the small tests, let me look into what the other flags do and try to simplify if we can. Comment Actions
Sent D145521 to match filenames which define interceptors. |