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 %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 %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 14 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 21 // 22 // CHECK: "-cc1" 23 // CHECK: "-opt-record-file" "FOO.opt.yaml" 24 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_20.opt.yaml" 28 29 // CHECK-EQ: "-cc1" 30 // CHECK-EQ: "-opt-record-file" "BAR.txt" 31 32 // CHECK-FOPT-DISABLE-NOT: "-fno-save-optimization-record" 33 34 // CHECK-EQ-PASSES: "-cc1" 35 // CHECK-EQ-PASSES: "-opt-record-passes" "inline" 36 37 // CHECK-FOPT-DISABLE-PASSES-NOT: "-fno-save-optimization-record" 38 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" 42 43 // CHECK-FOPT-DISABLE-FORMAT-NOT: "-fno-save-optimization-record" 44 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 48 49 // Pass-through: 50 // RUN: %clang -target x86_64-linux -### -fuse-ld=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 -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 -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 -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 -flto=thin -fdiagnostics-hotness-threshold=auto -Rpass=inline -Rpass-missed=inline -Rpass-analysis=inline %s 2>&1 | FileCheck %s -check-prefix=CHECK-PASS-AUTO 55 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" 60 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" 65 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" 70 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" 74 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" 79 80 // CHECK-PASS-AUTO: "--plugin-opt=opt-remarks-hotness-threshold=auto" 81