Skip to content

Commit acbdd6f

Browse files
author
Wael Yehia
committed
Enable continous mode PGO tests on AIX
1 parent de0fd64 commit acbdd6f

File tree

9 files changed

+43
-19
lines changed

9 files changed

+43
-19
lines changed

compiler-rt/test/profile/ContinuousSyncMode/basic.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// REQUIRES: darwin
1+
// REQUIRES: target={{.*(darwin|aix).*}}
22

3-
// RUN: %clang -fprofile-instr-generate -fcoverage-mapping -o %t.exe %s
3+
// RUN: %clang_profgen_cont -fcoverage-mapping -o %t.exe %s
44
// RUN: echo "garbage" > %t.profraw
55
// RUN: env LLVM_PROFILE_FILE="%c%t.profraw" %run %t.exe
66
// RUN: llvm-profdata show --counts --all-functions %t.profraw | FileCheck %s -check-prefix=CHECK-COUNTS
77
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
8-
// RUN: llvm-cov report %t.exe -instr-profile %t.profdata | FileCheck %s -check-prefix=CHECK-COVERAGE
8+
// RUN: %if !target={{.*aix.*}} %{ llvm-cov report %t.exe -instr-profile %t.profdata | FileCheck %s -check-prefix=CHECK-COVERAGE %}
99

1010
// CHECK-COUNTS: Counters:
1111
// CHECK-COUNTS-NEXT: main:

compiler-rt/test/profile/ContinuousSyncMode/get-filename.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// REQUIRES: darwin
1+
// REQUIRES: target={{.*(darwin|aix).*}}
22

3-
// RUN: %clang_pgogen -o %t.exe %s
3+
// RUN: %clang_pgogen_cont -o %t.exe %s
44
// RUN: env LLVM_PROFILE_FILE="%c%t.profraw" %run %t.exe %t.profraw
55
// RUN: env LLVM_PROFILE_FILE="%t%c.profraw" %run %t.exe %t.profraw
66
// RUN: env LLVM_PROFILE_FILE="%t.profraw%c" %run %t.exe %t.profraw

compiler-rt/test/profile/ContinuousSyncMode/image-with-mcdc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// REQUIRES: darwin
1+
// REQUIRES: target={{.*(darwin|aix).*}}
22

3-
// RUN: %clang_profgen -fcoverage-mapping -fcoverage-mcdc -O3 -o %t.exe %s
3+
// RUN: %clang_profgen_cont -fcoverage-mapping -fcoverage-mcdc -O3 -o %t.exe %s
44
// RUN: env LLVM_PROFILE_FILE="%c%t.profraw" %run %t.exe 3 3
55
// RUN: llvm-profdata show --text --all-functions %t.profraw | FileCheck %s
66

compiler-rt/test/profile/ContinuousSyncMode/image-with-no-counters.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// REQUIRES: darwin
1+
// REQUIRES: target={{.*(darwin|aix).*}}
22

33
// RUN: echo "static void dead_code(void) {}" > %t.dso.c
4-
// RUN: %clang_profgen -fcoverage-mapping -O3 -dynamiclib -o %t.dso.dylib %t.dso.c
5-
// RUN: %clang_profgen -fcoverage-mapping -O3 -o %t.exe %s %t.dso.dylib
4+
// RUN: %clang_profgen_cont -fcoverage-mapping -O3 %shared_lib_flag -o %t.dso.dylib %t.dso.c
5+
// RUN: %clang_profgen_cont -fcoverage-mapping -O3 -o %t.exe %s %t.dso.dylib
66
// RUN: env LLVM_PROFILE_FILE="%c%t.profraw" %run %t.exe 2>&1 | count 0
77
// RUN: llvm-profdata show --counts --all-functions %t.profraw | FileCheck %s
88

compiler-rt/test/profile/ContinuousSyncMode/online-merging.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: darwin
1+
// REQUIRES: target={{.*(darwin|aix).*}}
22

33
// Test the online merging mode (%m) along with continuous mode (%c).
44
//
@@ -8,9 +8,9 @@
88
// Create two DSOs and a driver program that uses them.
99
// RUN: echo "void dso1(void) {}" > dso1.c
1010
// RUN: echo "void dso2(void) {}" > dso2.c
11-
// RUN: %clang_pgogen -dynamiclib -o %t.dir/dso1.dylib dso1.c -mllvm -instrprof-atomic-counter-update-all=1
12-
// RUN: %clang_pgogen -dynamiclib -o %t.dir/dso2.dylib dso2.c -mllvm -instrprof-atomic-counter-update-all=1
13-
// RUN: %clang_pgogen -o main.exe %s %t.dir/dso1.dylib %t.dir/dso2.dylib -mllvm -instrprof-atomic-counter-update-all=1
11+
// RUN: %clang_pgogen_cont %shared_lib_flag -o %t.dir/dso1.dylib dso1.c -mllvm -instrprof-atomic-counter-update-all=1
12+
// RUN: %clang_pgogen_cont %shared_lib_flag -o %t.dir/dso2.dylib dso2.c -mllvm -instrprof-atomic-counter-update-all=1
13+
// RUN: %clang_pgogen_cont -o main.exe %s %t.dir/dso1.dylib %t.dir/dso2.dylib -mllvm -instrprof-atomic-counter-update-all=1
1414
//
1515
// === Round 1 ===
1616
// Test merging+continuous mode without any file contention.

compiler-rt/test/profile/ContinuousSyncMode/pid-substitution.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// REQUIRES: darwin
1+
// REQUIRES: target={{.*(darwin|aix).*}}
22

33
// RUN: rm -rf %t.dir && mkdir -p %t.dir
4-
// RUN: %clang_pgogen -o %t.exe %s
4+
// RUN: %clang_pgogen_cont -o %t.exe %s
55
//
66
// Note: %%p is needed here, not %p, because of lit's path substitution.
77
// RUN: env LLVM_PROFILE_FILE="%t.dir/%c-%%p" %run %t.exe

compiler-rt/test/profile/ContinuousSyncMode/reset-default-profile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: darwin || linux
1+
// REQUIRES: target={{.*(darwin|linux|aix).*}}
22

33
// Test when LLVM_PROFILE_FILE is set incorrectly, it should fall backs to use default.profraw without runtime error.
44

compiler-rt/test/profile/ContinuousSyncMode/set-filename.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// REQUIRES: darwin
1+
// REQUIRES: target={{.*(darwin|aix).*}}
22

3-
// RUN: %clang_pgogen -o %t.exe %s
3+
// RUN: %clang_pgogen_cont -o %t.exe %s
44
// RUN: env LLVM_PROFILE_FILE="%c%t.profraw" %run %t.exe %t.profraw %t.bad
55

66
#include <string.h>

compiler-rt/test/profile/lit.cfg.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ def get_required_attr(config, attr_name):
3030

3131
target_is_msvc = bool(re.match(r".*-windows-msvc$", config.target_triple))
3232

33+
# Whether continous profile collection (%c) requires runtime counter relocation on this platform
34+
runtime_reloc = bool(config.host_os in ["AIX"])
35+
3336
if config.host_os in ["Linux"]:
3437
extra_link_flags = ["-ldl"]
3538
elif target_is_msvc:
@@ -154,6 +157,22 @@ def exclude_unsupported_files_for_aix(dirname):
154157
)
155158
)
156159

160+
config.substitutions.append(
161+
(
162+
"%clang_profgen_cont",
163+
build_invocation(clang_cflags) + " -fprofile-instr-generate " +
164+
("-mllvm -runtime-counter-relocation" if runtime_reloc else "")
165+
)
166+
)
167+
168+
config.substitutions.append(
169+
(
170+
"%clang_pgogen_cont",
171+
build_invocation(clang_cflags) + " -fprofile-generate " +
172+
("-mllvm -runtime-counter-relocation" if runtime_reloc else "")
173+
)
174+
)
175+
157176
if config.host_os not in [
158177
"Windows",
159178
"Darwin",
@@ -166,6 +185,11 @@ def exclude_unsupported_files_for_aix(dirname):
166185
]:
167186
config.unsupported = True
168187

188+
config.substitutions.append(
189+
("%shared_lib_flag",
190+
"-dynamiclib" if (config.host_os == "Darwin") else "-shared")
191+
)
192+
169193
if config.host_os in ["AIX"]:
170194
config.available_features.add("system-aix")
171195
exclude_unsupported_files_for_aix(config.test_source_root)

0 commit comments

Comments
 (0)