xref: /llvm-project/llvm/test/ThinLTO/X86/section.ll (revision 05a358cdcd55d1ee0a0d92383aa49489479c6362)
1b4e1e829SMehdi Amini; Do setup work for all below tests: generate bitcode and combined index
2b4e1e829SMehdi Amini; RUN: opt -module-summary %s -o %t.bc
3b4e1e829SMehdi Amini; RUN: opt -module-summary %p/Inputs/section.ll -o %t2.bc
4b4e1e829SMehdi Amini; RUN: llvm-lto -thinlto-action=thinlink -o %t3.bc %t.bc %t2.bc
5b4e1e829SMehdi Amini
6b4e1e829SMehdi Amini; Check that we don't promote 'var_with_section'
7b4e1e829SMehdi Amini; RUN: llvm-lto -thinlto-action=promote %t2.bc -thinlto-index=%t3.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=PROMOTE
8b4e1e829SMehdi Amini; PROMOTE: @var_with_section = internal global i32 0, section "some_section"
9b4e1e829SMehdi Amini
10b4e1e829SMehdi Amini; RUN: llvm-lto -thinlto-action=import %t.bc -thinlto-index=%t3.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=IMPORT
11b4e1e829SMehdi Amini; Check that section prevent import of @reference_gv_with_section.
12b4e1e829SMehdi Amini; IMPORT: declare void @reference_gv_with_section()
13b4e1e829SMehdi Amini; Canary to check that importing is correctly set up.
14b4e1e829SMehdi Amini; IMPORT: define available_externally void @foo()
15*05a358cdSSteven Wutarget datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
16b4e1e829SMehdi Amini
17b4e1e829SMehdi Amini
18b4e1e829SMehdi Aminidefine i32 @main() {
19b4e1e829SMehdi Amini    call void @reference_gv_with_section()
20b4e1e829SMehdi Amini    call void @foo()
21b4e1e829SMehdi Amini    ret i32 42
22b4e1e829SMehdi Amini}
23b4e1e829SMehdi Amini
24b4e1e829SMehdi Amini
25b4e1e829SMehdi Aminideclare void @reference_gv_with_section()
26b4e1e829SMehdi Aminideclare void @foo()
27