[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Driver / opt-record.c
blob220f5db7fbca2c43a3f7ccad80324c5c68b0a346
1 // RUN: %clang -### -S -o FOO -fsave-optimization-record %s 2>&1 | FileCheck %s
2 // RUN: %clang -### -c -o FOO -fsave-optimization-record %s 2>&1 | FileCheck %s
3 // RUN: %clang -### -c -o FOO.o -fsave-optimization-record %s 2>&1 | FileCheck %s
4 // RUN: %clang -### -save-temps -S -o FOO -fsave-optimization-record %s 2>&1 | FileCheck %s
5 // RUN: %clang -### -save-temps -c -o FOO.o -fsave-optimization-record %s 2>&1 | FileCheck %s
6 // RUN: %clang -### -c -fsave-optimization-record %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-O
7 // RUN: %clang -### -save-temps -c -fsave-optimization-record %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-O
8 // RUN: %clang -### -fsave-optimization-record %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-O
9 // RUN: %clang -### -S -fsave-optimization-record -x cuda -nocudainc -nocudalib --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-O -check-prefix=CHECK-CUDA-DEV
10 // RUN: %clang -### -fsave-optimization-record -x cuda -nocudainc -nocudalib --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-O -check-prefix=CHECK-CUDA-DEV
11 // RUN: %clang -### -S -o FOO -fsave-optimization-record -foptimization-record-file=BAR.txt %s 2>&1 | FileCheck %s -check-prefix=CHECK-EQ
12 // RUN: %clang -### -S -o FOO -foptimization-record-file=BAR.txt %s 2>&1 | FileCheck %s -check-prefix=CHECK-EQ
13 // RUN: %clang -### -S -o FOO -foptimization-record-file=BAR.txt -fno-save-optimization-record %s 2>&1 | FileCheck %s --check-prefix=CHECK-FOPT-DISABLE
15 // RUN: %clang -### -S -o FOO -fsave-optimization-record -foptimization-record-passes=inline %s 2>&1 | FileCheck %s -check-prefix=CHECK-EQ-PASSES
16 // RUN: %clang -### -S -o FOO -foptimization-record-passes=inline %s 2>&1 | FileCheck %s -check-prefix=CHECK-EQ-PASSES
17 // RUN: %clang -### -S -o FOO -foptimization-record-passes=inline -fno-save-optimization-record %s 2>&1 | FileCheck %s --check-prefix=CHECK-FOPT-DISABLE-PASSES
18 // RUN: %clang -### -S -o FOO -fsave-optimization-record -fsave-optimization-record=some-format %s 2>&1 | FileCheck %s -check-prefix=CHECK-EQ-FORMAT
19 // RUN: %clang -### -S -o FOO -fsave-optimization-record=some-format %s 2>&1 | FileCheck %s -check-prefix=CHECK-EQ-FORMAT
20 // RUN: %clang -### -S -o FOO -fsave-optimization-record=some-format -fno-save-optimization-record %s 2>&1 | FileCheck %s --check-prefix=CHECK-FOPT-DISABLE-FORMAT
22 // CHECK: "-cc1"
23 // CHECK: "-opt-record-file" "FOO.opt.yaml"
25 // CHECK-NO-O: "-cc1"
26 // CHECK-NO-O-DAG: "-opt-record-file" "opt-record.opt.yaml"
27 // CHECK-CUDA-DEV-DAG: "-opt-record-file" "opt-record-cuda-{{nvptx64|nvptx}}-nvidia-cuda-sm_{{.*}}.opt.yaml"
29 // CHECK-EQ: "-cc1"
30 // CHECK-EQ: "-opt-record-file" "BAR.txt"
32 // CHECK-FOPT-DISABLE-NOT: "-fno-save-optimization-record"
34 // CHECK-EQ-PASSES: "-cc1"
35 // CHECK-EQ-PASSES: "-opt-record-passes" "inline"
37 // CHECK-FOPT-DISABLE-PASSES-NOT: "-fno-save-optimization-record"
39 // CHECK-EQ-FORMAT: "-cc1"
40 // CHECK-EQ-FORMAT: "-opt-record-file" "FOO.opt.some-format"
41 // CHECK-EQ-FORMAT: "-opt-record-format" "some-format"
43 // CHECK-FOPT-DISABLE-FORMAT-NOT: "-fno-save-optimization-record"
45 // Test remarks options pass-through
46 // No pass-through: lto is disabled
47 // RUN: %clang --target=x86_64 -### -o FOO -fdiagnostics-hotness-threshold=100 -fsave-optimization-record %s 2>&1 | FileCheck %s -check-prefix=CHECK-NOPASS
49 // Pass-through:
50 // RUN: %clang --target=x86_64-linux -### -fuse-ld=lld -B%S/Inputs/lld -flto -fdiagnostics-hotness-threshold=100 -fsave-optimization-record -foptimization-record-passes=inline %s 2>&1 | FileCheck %s -check-prefix=CHECK-PASS-A
51 // RUN: %clang --target=x86_64-linux -### -o FOO --sysroot=%S/Inputs/basic_cross_linux_tree -fuse-ld=gold -flto -fdiagnostics-hotness-threshold=100 -fsave-optimization-record -foptimization-record-passes=inline %s 2>&1 | FileCheck %s -check-prefix=CHECK-PASS
52 // RUN: %clang --target=x86_64-linux -### -o FOO -fuse-ld=lld -B%S/Inputs/lld -flto=thin -fdiagnostics-hotness-threshold=100 -fsave-optimization-record=some-format -foptimization-record-file=FOO.txt %s 2>&1 | FileCheck %s -check-prefix=CHECK-PASS-CUSTOM
53 // RUN: %clang --target=x86_64-linux -### -o FOO -fuse-ld=lld -B%S/Inputs/lld -flto=thin -fdiagnostics-hotness-threshold=100 -Rpass=inline -Rpass-missed=inline -Rpass-analysis=inline %s 2>&1 | FileCheck %s -check-prefix=CHECK-PASS-RPASS
54 // RUN: %clang --target=x86_64-linux -### -o FOO -fuse-ld=lld -B%S/Inputs/lld -flto=thin -fdiagnostics-hotness-threshold=auto -Rpass=inline -Rpass-missed=inline -Rpass-analysis=inline %s 2>&1 | FileCheck %s -check-prefix=CHECK-PASS-AUTO
56 // CHECK-NOPASS-NOT: "-plugin-opt=opt-remarks-filename="
57 // CHECK-NOPASS-NOT: "-plugin-opt=opt-remarks-passes=inline"
58 // CHECK-NOPASS-NOT: "-plugin-opt=opt-remarks-format=yaml"
59 // CHECK-NOPASS-NOT: "-plugin-opt=opt-remarks-hotness-threshold=100"
61 // CHECK-PASS-A: "-plugin-opt=opt-remarks-filename=a.out.opt.ld.yaml"
62 // CHECK-PASS-A-SAME: "-plugin-opt=opt-remarks-passes=inline"
63 // CHECK-PASS-A-SAME: "-plugin-opt=opt-remarks-format=yaml"
64 // CHECK-PASS-A-SAME: "-plugin-opt=opt-remarks-hotness-threshold=100"
66 // CHECK-PASS: "-plugin-opt=opt-remarks-filename=FOO.opt.ld.yaml"
67 // CHECK-PASS-SAME: "-plugin-opt=opt-remarks-passes=inline"
68 // CHECK-PASS-SAME: "-plugin-opt=opt-remarks-format=yaml"
69 // CHECK-PASS-SAME: "-plugin-opt=opt-remarks-hotness-threshold=100"
71 // CHECK-PASS-CUSTOM: "-plugin-opt=opt-remarks-filename=FOO.txt.opt.ld.some-format"
72 // CHECK-PASS-CUSTOM-SAME: "-plugin-opt=opt-remarks-format=some-format"
73 // CHECK-PASS-CUSTOM-SAME: "-plugin-opt=opt-remarks-hotness-threshold=100"
75 // CHECK-PASS-RPASS: "-plugin-opt=-pass-remarks=inline"
76 // CHECK-PASS-RPASS-SAME: "-plugin-opt=-pass-remarks-missed=inline"
77 // CHECK-PASS-RPASS-SAME: "-plugin-opt=-pass-remarks-analysis=inline"
78 // CHECK-PASS-RPASS-SAME: "-plugin-opt=opt-remarks-hotness-threshold=100"
80 // CHECK-PASS-AUTO: "-plugin-opt=opt-remarks-hotness-threshold=auto"