xref: /llvm-project/llvm/test/ThinLTO/X86/import-symver.ll (revision 437c4653855fbbe47a860ae95eb445fd004aa4de)
1; RUN: opt -thinlto-bc %s -o %t1.bc
2; RUN: opt -thinlto-bc %p/Inputs/import-symver-foo.ll -o %t2.bc
3; RUN: llvm-lto -thinlto-action=thinlink %t1.bc %t2.bc -o %t3.index.bc
4
5; RUN: llvm-lto -thinlto-action=import -exported-symbol=main %t1.bc -thinlto-index=%t3.index.bc
6; RUN: llvm-dis %t1.bc.thinlto.imported.bc -o - | FileCheck --check-prefix=IMPORT %s
7
8; RUN: llvm-lto -thinlto-action=import -exported-symbol=main -import-instr-limit=0 %t1.bc -thinlto-index=%t3.index.bc
9; RUN: llvm-dis %t1.bc.thinlto.imported.bc -o - | FileCheck --check-prefix=NOIMPORT %s
10
11; When @bar gets imported, the symver must be imported too.
12; IMPORT: module asm ".symver bar, bar@BAR_1.2.3"
13; IMPORT: declare dso_local i32 @bar()
14
15; When @bar isn't imported, the symver is also not imported.
16; NOIMPORT-NOT: module asm
17; NOIMPORT-NOT: declare dso_local i32 @bar()
18
19target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
20target triple = "x86_64-unknown-linux-gnu"
21
22declare dso_local i32 @foo()
23
24define dso_local i32 @main() {
25entry:
26  %call = tail call i32 @foo()
27  ret i32 %call
28}
29