1 // -flto causes a switch to llvm-bc object files. 2 // RUN: %clang -ccc-print-phases -c %s -flto 2> %t 3 // RUN: FileCheck -check-prefix=CHECK-COMPILE-ACTIONS < %t %s 4 // 5 // CHECK-COMPILE-ACTIONS: 2: compiler, {1}, ir 6 // CHECK-COMPILE-ACTIONS: 3: backend, {2}, lto-bc 7 8 // RUN: %clang -ccc-print-phases %s -flto 2> %t 9 // RUN: FileCheck -check-prefix=CHECK-COMPILELINK-ACTIONS < %t %s 10 // 11 // CHECK-COMPILELINK-ACTIONS: 0: input, "{{.*}}lto.c", c 12 // CHECK-COMPILELINK-ACTIONS: 1: preprocessor, {0}, cpp-output 13 // CHECK-COMPILELINK-ACTIONS: 2: compiler, {1}, ir 14 // CHECK-COMPILELINK-ACTIONS: 3: backend, {2}, lto-bc 15 // CHECK-COMPILELINK-ACTIONS: 4: linker, {3}, image 16 17 // llvm-bc and llvm-ll outputs need to match regular suffixes 18 // (unfortunately). 19 // RUN: %clang %s -flto -save-temps -### 2> %t 20 // RUN: FileCheck -check-prefix=CHECK-COMPILELINK-SUFFIXES < %t %s 21 // 22 // CHECK-COMPILELINK-SUFFIXES: "-o" "{{.*}}lto.i" "-x" "c" "{{.*}}lto.c" 23 // CHECK-COMPILELINK-SUFFIXES: "-o" "{{.*}}lto.bc" {{.*}}"{{.*}}lto.i" 24 // CHECK-COMPILELINK-SUFFIXES: "-o" "{{.*}}lto.o" {{.*}}"{{.*}}lto.bc" 25 // CHECK-COMPILELINK-SUFFIXES: "{{.*}}a.{{(out|exe)}}" {{.*}}"{{.*}}lto.o" 26 27 // RUN: %clang %s -flto -S -### 2> %t 28 // RUN: FileCheck -check-prefix=CHECK-COMPILE-SUFFIXES < %t %s 29 // 30 // CHECK-COMPILE-SUFFIXES: "-o" "{{.*}}lto.s" "-x" "c" "{{.*}}lto.c" 31 32 // RUN: not %clang %s -emit-llvm 2>&1 | FileCheck --check-prefix=LLVM-LINK %s 33 // LLVM-LINK: -emit-llvm cannot be used when linking 34 35 /// With ld.bfd or gold, link against LLVMgold. 36 // RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \ 37 // RUN: -fuse-ld=bfd -flto=thin -### 2>&1 | FileCheck --check-prefix=LLVMGOLD %s 38 // RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \ 39 // RUN: -fuse-ld=gold -flto=full -### 2>&1 | FileCheck --check-prefix=LLVMGOLD %s 40 // RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \ 41 // RUN: -fuse-ld=gold -fno-lto -flto -### 2>&1 | FileCheck --check-prefix=LLVMGOLD %s 42 // LLVMGOLD: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}" 43 44 /// lld does not need LLVMgold. 45 // RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \ 46 // RUN: -fuse-ld=lld -flto -### 2>&1 | FileCheck --check-prefix=NO-LLVMGOLD %s 47 // RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \ 48 // RUN: -fuse-ld=gold -flto -fno-lto -### 2>&1 | FileCheck --check-prefix=NO-LLVMGOLD %s 49 // NO-LLVMGOLD-NOT: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}" 50 51 // RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \ 52 // RUN: -fuse-ld=lld -flto -O -### 2>&1 | FileCheck --check-prefix=O1 %s 53 // RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \ 54 // RUN: -fuse-ld=lld -flto -O1 -### 2>&1 | FileCheck --check-prefix=O1 %s 55 // RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \ 56 // RUN: -fuse-ld=lld -flto -Og -### 2>&1 | FileCheck --check-prefix=O1 %s 57 // RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \ 58 // RUN: -fuse-ld=lld -flto -O2 -### 2>&1 | FileCheck --check-prefix=O2 %s 59 // RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \ 60 // RUN: -fuse-ld=lld -flto -Os -### 2>&1 | FileCheck --check-prefix=O2 %s 61 // RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \ 62 // RUN: -fuse-ld=lld -flto -Oz -### 2>&1 | FileCheck --check-prefix=O2 %s 63 // RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \ 64 // RUN: -fuse-ld=lld -flto -O3 -### 2>&1 | FileCheck --check-prefix=O3 %s 65 // RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \ 66 // RUN: -fuse-ld=lld -flto -Ofast -### 2>&1 | FileCheck --check-prefix=O3 %s 67 68 // O1: -plugin-opt=O1 69 // O2: -plugin-opt=O2 70 // O3: -plugin-opt=O3 71 72 // -flto passes along an explicit debugger tuning argument. 73 // RUN: %clang -target x86_64-unknown-linux -### %s -flto -glldb 2> %t 74 // RUN: FileCheck -check-prefix=CHECK-TUNING-LLDB < %t %s 75 // RUN: %clang -target x86_64-unknown-linux -### %s -flto -g 2> %t 76 // RUN: FileCheck -check-prefix=CHECK-NO-TUNING < %t %s 77 // 78 // CHECK-TUNING-LLDB: "-plugin-opt=-debugger-tune=lldb" 79 // CHECK-NO-TUNING-NOT: "-plugin-opt=-debugger-tune 80