1 #include "comdat_rename.h"
2 // callee's out-of-line instance profile data -- it comes
3 // from external calls to it from comdat_rename_2.cpp.
4 // Its inline instance copy's profile data is different and
5 // is collected in 'caller''s context.
callee()6 int FOO::callee() {
7 // CHECK-LABEL: define {{.*}}callee{{.*}}
8 // CHECK-NOT: br i1 {{.*}}
9 // CHECK: br {{.*}}label{{.*}}, label %[[BB1:.*]], !prof ![[PD1:[0-9]+]]
10 // CHECK: {{.*}}[[BB1]]:
11 if (b != 0)
12 return a / b;
13 if (a != 0)
14 return 10 / a;
15 return 0;
16 }
17
18 // This is the 'caller''s comdat copy (after renaming) in this module.
19 // The profile counters include a copy of counters from 'callee':
20 //
21 // CHECK-LABEL: define {{.*}}caller{{.*}}
22 // CHECK-NOT: br i1 {{.*}}
23 // CHECK: br {{.*}}label{{.*}}, label %[[BB2:.*]], !prof ![[PD2:[0-9]+]]
24 // CHECK: {{.*}}[[BB2]]:
25 // CHECK: br {{.*}}label{{.*}}, label %{{.*}}, !prof !{{.*}}
26 // CHECK: br {{.*}}label %[[BB3:.*]], label %{{.*}} !prof ![[PD3:[0-9]+]]
27 // CHECK: {{.*}}[[BB3]]:
28 //
29 // CHECK:![[PD1]] = !{!"branch_weights", i32 0, i32 1}
30 // CHECK:![[PD2]] = !{!"branch_weights", i32 1, i32 0}
31 // CHECK:![[PD3]] = !{!"branch_weights", i32 {{.*}}, i32 0}
32
test(FOO * foo)33 void test(FOO *foo) { foo->caller(10); }
34