Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[profile] Do not cache __llvm_profile_get_filename result
When the %m filename pattern is used, the filename is unique to each image, so the cached value is wrong. It struck me that the full filename isn't something that's recomputed often, so perhaps it doesn't need to be cached at all. David Li pointed out we can go further and just hide lprofCurFilename. This may regress workflows that depend on using the set-filename API to change filenames across all loaded DSOs, but this is expected to be very rare. rdar://55137071 Differential Revision: https://reviews.llvm.org/D69137 llvm-svn: 375301
- Loading branch information
Showing
7 changed files
with
40 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const char *__llvm_profile_get_filename(void); | ||
|
||
const char *get_filename_from_DSO(void) { | ||
return __llvm_profile_get_filename(); | ||
} |
8 changes: 0 additions & 8 deletions
8
compiler-rt/test/profile/Posix/instrprof-set-filename-shared.test
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
compiler-rt/test/profile/instrprof-get-filename-merge-mode.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Test __llvm_profile_get_filename when the on-line merging mode is enabled. | ||
// | ||
// RUN: %clang_pgogen -dynamiclib -o %t.dso %p/Inputs/instrprof-get-filename-dso.c | ||
// RUN: %clang_pgogen -o %t %s %t.dso | ||
// RUN: env LLVM_PROFILE_FILE="%t-%m.profraw" %run %t | ||
|
||
#include <string.h> | ||
|
||
const char *__llvm_profile_get_filename(void); | ||
extern const char *get_filename_from_DSO(void); | ||
|
||
int main(int argc, const char *argv[]) { | ||
const char *filename1 = __llvm_profile_get_filename(); | ||
const char *filename2 = get_filename_from_DSO(); | ||
|
||
// Exit with code 1 if the two filenames are the same. | ||
return strcmp(filename1, filename2) == 0; | ||
} |