xref: /llvm-project/llvm/test/ThinLTO/X86/funcimport2.ll (revision 7b1d793713cf9ed9ab719f33b332f9c66a1fc5cc)
1002af9bbSTeresa Johnson; Do setup work for all below tests: generate bitcode and combined index
2002af9bbSTeresa Johnson; RUN: opt -module-summary %s -o %t1.bc
3002af9bbSTeresa Johnson; RUN: opt -module-summary %p/Inputs/funcimport2.ll -o %t2.bc
4002af9bbSTeresa Johnson
57faa60c4SPeter Collingbourne; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
6002af9bbSTeresa Johnson; RUN:     -r=%t1.bc,_foo,plx \
7002af9bbSTeresa Johnson; RUN:     -r=%t2.bc,_main,plx \
8cb9a82fcSTeresa Johnson; RUN:     -r=%t2.bc,_foo,l \
9cb9a82fcSTeresa Johnson; RUN:	   -print-import-failures 2>&1 | FileCheck %s --check-prefix=NOFAILURES
10a5376f39SVitaly Buka; RUN: llvm-dis %t.o.2.3.import.bc -o - | FileCheck %s
114595a915SSean Fertile; CHECK: define available_externally dso_local void @foo()
12cb9a82fcSTeresa Johnson; Don't expect any failure messages from -print-import-failures
13cb9a82fcSTeresa Johnson; NOFAILURES-NOT: Reason =
14cb9a82fcSTeresa Johnson
15cb9a82fcSTeresa Johnson; We shouldn't do any importing with a 0 instruction limit, in which case
16cb9a82fcSTeresa Johnson; -print-import-failures should print a TooLarge reason.
17cb9a82fcSTeresa Johnson; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
18cb9a82fcSTeresa Johnson; RUN:     -r=%t1.bc,_foo,plx \
19cb9a82fcSTeresa Johnson; RUN:     -r=%t2.bc,_main,plx \
20cb9a82fcSTeresa Johnson; RUN:     -r=%t2.bc,_foo,l \
21cb9a82fcSTeresa Johnson; RUN:	   -import-instr-limit=0 \
22cb9a82fcSTeresa Johnson; RUN:	   -print-import-failures 2>&1 | FileCheck %s --check-prefix=FAILURES
23cb9a82fcSTeresa Johnson; RUN: llvm-dis %t.o.2.3.import.bc -o - | FileCheck %s --check-prefix=NOIMPORT
24cb9a82fcSTeresa Johnson; FAILURES: (foo): Reason = TooLarge, Threshold = 0, Size = 1, MaxHotness = unknown, Attempts = 1
25002af9bbSTeresa Johnson
26002af9bbSTeresa Johnson; We shouldn't do any importing at -O0
27002af9bbSTeresa Johnson; rm -f %t.o.1.3.import.bc
287faa60c4SPeter Collingbourne; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
29002af9bbSTeresa Johnson; RUN:     -O0 \
30002af9bbSTeresa Johnson; RUN:     -r=%t1.bc,_foo,plx \
31002af9bbSTeresa Johnson; RUN:     -r=%t2.bc,_main,plx \
32002af9bbSTeresa Johnson; RUN:     -r=%t2.bc,_foo,l
33cb9a82fcSTeresa Johnson; RUN: llvm-dis %t.o.2.3.import.bc -o - | FileCheck %s --check-prefix=NOIMPORT
34cb9a82fcSTeresa Johnson; NOIMPORT: declare dso_local void @foo(...)
35002af9bbSTeresa Johnson
36*7b1d7937SAmy Huangtarget datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
37002af9bbSTeresa Johnsontarget triple = "x86_64-apple-macosx10.11.0"
38002af9bbSTeresa Johnson
39002af9bbSTeresa Johnsondefine void @foo() #0 {
40002af9bbSTeresa Johnsonentry:
41002af9bbSTeresa Johnson  ret void
42002af9bbSTeresa Johnson}
43