xref: /minix3/external/bsd/llvm/dist/clang/test/Driver/lto.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // -flto causes a switch to llvm-bc object files.
2f4a2713aSLionel Sambuc // RUN: %clang -ccc-print-phases -c %s -flto 2> %t.log
3*0a6a1f1dSLionel Sambuc // RUN: grep '2: compiler, {1}, ir' %t.log
4*0a6a1f1dSLionel Sambuc // RUN: grep '3: backend, {2}, lto-bc' %t.log
5f4a2713aSLionel Sambuc 
6f4a2713aSLionel Sambuc // RUN: %clang -ccc-print-phases %s -flto 2> %t.log
7f4a2713aSLionel Sambuc // RUN: grep '0: input, ".*lto.c", c' %t.log
8f4a2713aSLionel Sambuc // RUN: grep '1: preprocessor, {0}, cpp-output' %t.log
9*0a6a1f1dSLionel Sambuc // RUN: grep '2: compiler, {1}, ir' %t.log
10*0a6a1f1dSLionel Sambuc // RUN: grep '3: backend, {2}, lto-bc' %t.log
11*0a6a1f1dSLionel Sambuc // RUN: grep '4: linker, {3}, image' %t.log
12f4a2713aSLionel Sambuc 
13f4a2713aSLionel Sambuc // llvm-bc and llvm-ll outputs need to match regular suffixes
14f4a2713aSLionel Sambuc // (unfortunately).
15f4a2713aSLionel Sambuc // RUN: %clang %s -flto -save-temps -### 2> %t.log
16f4a2713aSLionel Sambuc // RUN: grep '"-o" ".*lto\.i" "-x" "c" ".*lto\.c"' %t.log
17*0a6a1f1dSLionel Sambuc // RUN: grep '"-o" ".*lto\.bc" .*".*lto\.i"' %t.log
18*0a6a1f1dSLionel Sambuc // RUN: grep '"-o" ".*lto\.o" .*".*lto\.bc"' %t.log
19*0a6a1f1dSLionel Sambuc // RUN: grep '".*a\.\(out\|exe\)" .*".*lto\.o"' %t.log
20f4a2713aSLionel Sambuc 
21f4a2713aSLionel Sambuc // RUN: %clang %s -flto -S -### 2> %t.log
22f4a2713aSLionel Sambuc // RUN: grep '"-o" ".*lto\.s" "-x" "c" ".*lto\.c"' %t.log
23f4a2713aSLionel Sambuc 
24f4a2713aSLionel Sambuc // RUN: not %clang %s -emit-llvm 2>&1 | FileCheck --check-prefix=LLVM-LINK %s
25f4a2713aSLionel Sambuc // LLVM-LINK: -emit-llvm cannot be used when linking
26