diff options
author | Justin Bogner <mail@justinbogner.com> | 2014-09-04 15:45:31 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2014-09-04 15:45:31 +0000 |
commit | 88c36887e0adec160d5a21c27bf5b9425a7d7f35 (patch) | |
tree | 7cce5f08e92927ccf2436785f83a1e46f4498c81 /test/profile/instrprof-basic.c | |
parent | 3c96c1e527878ad7d5222ad6a18fe16a29b7e775 (diff) |
profile: Avoid name collisions between instrumentation and runtime
The naming scheme we're using for counters in profile data shares a
prefix with some fixed names we use for the runtime, notably
__llvm_profile_data_begin and _end. Embarrassingly, this means a
function called begin() can't be instrumented.
This modifies the runtime names so as not to collide with the
instrumentation.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@217166 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/profile/instrprof-basic.c')
-rw-r--r-- | test/profile/instrprof-basic.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/test/profile/instrprof-basic.c b/test/profile/instrprof-basic.c index 3db083140..2356fb73b 100644 --- a/test/profile/instrprof-basic.c +++ b/test/profile/instrprof-basic.c @@ -3,10 +3,29 @@ // RUN: llvm-profdata merge -o %t.profdata %t.profraw // RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s -int main(int argc, const char *argv[]) { +int begin(int i) { // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !1 + if (i) + return 0; + return 1; +} + +int end(int i) { + // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !2 + if (i) + return 0; + return 1; +} + +int main(int argc, const char *argv[]) { + begin(0); + end(1); + + // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !2 if (argc) return 0; return 1; } -// CHECK: !1 = metadata !{metadata !"branch_weights", i32 2, i32 1} + +// CHECK: !1 = metadata !{metadata !"branch_weights", i32 1, i32 2} +// CHECK: !2 = metadata !{metadata !"branch_weights", i32 2, i32 1} |