1 // REQUIRES: x86-registered-target
3 // RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=full -ffat-lto-objects -fsplit-lto-unit -emit-llvm < %s | FileCheck %s --check-prefixes=FULL,SPLIT
4 // RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=full -ffat-lto-objects -emit-llvm < %s | FileCheck %s --check-prefixes=FULL,SPLIT
6 // RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=thin -fsplit-lto-unit -ffat-lto-objects -emit-llvm < %s | FileCheck %s --check-prefixes=THIN,SPLIT
7 // RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=thin -ffat-lto-objects -emit-llvm < %s | FileCheck %s --check-prefixes=THIN,NOSPLIT
9 // RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=full -ffat-lto-objects -fsplit-lto-unit -emit-obj < %s -o %t.full.split.o
10 // RUN: llvm-readelf -S %t.full.split.o | FileCheck %s --check-prefixes=ELF
11 // RUN: llvm-objcopy --dump-section=.llvm.lto=%t.full.split.bc %t.full.split.o
12 // RUN: llvm-dis %t.full.split.bc -o - | FileCheck %s --check-prefixes=FULL,SPLIT,NOUNIFIED
14 // RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=full -ffat-lto-objects -emit-obj < %s -o %t.full.nosplit.o
15 // RUN: llvm-readelf -S %t.full.nosplit.o | FileCheck %s --check-prefixes=ELF
16 // RUN: llvm-objcopy --dump-section=.llvm.lto=%t.full.nosplit.bc %t.full.nosplit.o
17 // RUN: llvm-dis %t.full.nosplit.bc -o - | FileCheck %s --check-prefixes=FULL,NOSPLIT,NOUNIFIED
19 // RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=thin -fsplit-lto-unit -ffat-lto-objects -emit-obj < %s -o %t.thin.split.o
20 // RUN: llvm-readelf -S %t.thin.split.o | FileCheck %s --check-prefixes=ELF
21 // RUN: llvm-objcopy --dump-section=.llvm.lto=%t.thin.split.bc %t.thin.split.o
22 // RUN: llvm-dis %t.thin.split.bc -o - | FileCheck %s --check-prefixes=THIN,SPLIT,NOUNIFIED
24 // RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=thin -ffat-lto-objects -emit-obj < %s -o %t.thin.nosplit.o
25 // RUN: llvm-readelf -S %t.thin.nosplit.o | FileCheck %s --check-prefixes=ELF
26 // RUN: llvm-objcopy --dump-section=.llvm.lto=%t.thin.nosplit.bc %t.thin.nosplit.o
27 // RUN: llvm-dis %t.thin.nosplit.bc -o - | FileCheck %s --check-prefixes=THIN,NOSPLIT,NOUNIFIED
29 // RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=thin -funified-lto -ffat-lto-objects -emit-obj < %s -o %t.unified.o
30 // RUN: llvm-readelf -S %t.unified.o | FileCheck %s --check-prefixes=ELF
31 // RUN: llvm-objcopy --dump-section=.llvm.lto=%t.unified.bc %t.unified.o
32 // RUN: llvm-dis %t.unified.bc -o - | FileCheck %s --check-prefixes=THIN,NOSPLIT,UNIFIED
34 // RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=full -ffat-lto-objects -fsplit-lto-unit -S < %s -o - \
35 // RUN: | FileCheck %s --check-prefixes=ASM
37 /// Check that the ThinLTO metadata is only set false for full LTO.
38 // FULL: ![[#]] = !{i32 1, !"ThinLTO", i32 0}
39 // THIN-NOT: ![[#]] = !{i32 1, !"ThinLTO", i32 0}
41 /// Be sure we enable split LTO units correctly under -ffat-lto-objects.
42 // SPLIT: ![[#]] = !{i32 1, !"EnableSplitLTOUnit", i32 1}
43 // NOSPLIT: ![[#]] = !{i32 1, !"EnableSplitLTOUnit", i32 0}
45 // UNIFIED: ![[#]] = !{i32 1, !"UnifiedLTO", i32 1}
46 // NOUNIFIED-NOT: ![[#]] = !{i32 1, !"UnifiedLTO", i32 1}
50 // ASM: .section .llvm.lto,"e",@progbits
51 // ASM-NEXT: .Lllvm.embedded.object:
52 // ASM-NEXT: .asciz "BC
53 // ASM-NEXT: .size .Lllvm.embedded.object