File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ // REQUIRES: target={{.*(darwin|aix).*}}
2+
3+ // RUN: rm -f %t.profraw
4+ // RUN: %clangxx_pgogen_cont -lpthread %s -o %t.exe -mllvm -disable-vp -fprofile-update=atomic
5+ // RUN: env LLVM_PROFILE_FILE="%c%t.profraw" %run %t.exe
6+ // RUN: llvm-profdata show --counts --function=accum %t.profraw | FileCheck %s
7+ // CHECK: Block counts: [100000, 4]
8+
9+ #include < thread>
10+
11+ int x = 0 ;
12+ void accum (int n) {
13+ for (int i = 0 ; i < n; i++)
14+ x += i; // don't care about accuracy, no need for atomic.
15+ }
16+
17+ int main () {
18+ int init_value = 10000 ;
19+ auto t1 = std::thread (accum, 1 *init_value);
20+ auto t2 = std::thread (accum, 2 *init_value);
21+ auto t3 = std::thread (accum, 3 *init_value);
22+ auto t4 = std::thread (accum, 4 *init_value);
23+
24+ t1.join ();
25+ t2.join ();
26+ t3.join ();
27+ t4.join ();
28+ return !x;
29+ }
Original file line number Diff line number Diff line change @@ -138,6 +138,14 @@ def exclude_unsupported_files_for_aix(dirname):
138138config .substitutions .append (
139139 ("%clangxx_pgogen=" , build_invocation (clang_cxxflags ) + " -fprofile-generate=" )
140140)
141+ config .substitutions .append (
142+ (
143+ "%clangxx_pgogen_cont " ,
144+ build_invocation (clang_cxxflags )
145+ + " -fprofile-generate "
146+ + ("-mllvm -runtime-counter-relocation " if runtime_reloc else "" ),
147+ )
148+ )
141149
142150config .substitutions .append (
143151 ("%clang_cspgogen " , build_invocation (clang_cflags ) + " -fcs-profile-generate " )
You can’t perform that action at this time.
0 commit comments