xref: /llvm-project/clang/test/Driver/fprofile-update.c (revision a6e6abd76cd31011f7685bda2c95ac6468df4f65)
1 /// For -fprofile-instr-generate and -fprofile-arcs, increment counters atomically
2 /// if -fprofile-update={atomic,prefer-atomic} is specified.
3 // RUN: %clang -### %s -c -fprofile-update=atomic 2>&1 | FileCheck %s
4 // RUN: %clang -### %s -c -fprofile-update=prefer-atomic 2>&1 | FileCheck %s
5 
6 // CHECK: "-fprofile-update=atomic"
7 
8 // RUN: %clang -### %s -c -fprofile-update=atomic -fprofile-update=single 2>&1 | FileCheck %s --check-prefix=SINGLE
9 
10 // SINGLE-NOT: "-fprofile-update=atomic"
11 
12 // RUN: not %clang %s -c -fprofile-update=unknown 2>&1 | FileCheck %s --check-prefix=ERROR
13 
14 // ERROR: error: unsupported argument 'unknown' to option '-fprofile-update='
15 
16 // AIX specific tests
17 // RUN: %clang -### %s --target=powerpc-unknown-aix -fprofile-generate -fprofile-update=atomic 2>&1 | FileCheck %s --check-prefix=AIX
18 // RUN: %clang -### %s --target=powerpc-unknown-aix -fprofile-generate -fprofile-update=prefer-atomic 2>&1 | FileCheck %s --check-prefix=AIX
19 // RUN: %clang -### %s --target=powerpc-unknown-aix -fprofile-generate 2>&1 | FileCheck %s --check-prefix=AIX-NOATOMIC
20 // RUN: %clang -### %s --target=powerpc-unknown-aix -fprofile-generate -fprofile-update=single 2>&1 | FileCheck %s --check-prefix=AIX-NOATOMIC
21 // AIX: "-latomic"
22 // AIX-NOATOMIC-NOT: "-latomic"
23