xref: /llvm-project/llvm/test/Transforms/FunctionImport/noinline.ll (revision 3713bc8a0b38c0c77238e3010e7dd53d50f3c523)
1bf612458SYaxun (Sam) Liu; Do setup work for all below tests: generate bitcode and combined index
2bf612458SYaxun (Sam) Liu; RUN: opt -module-summary %s -o %t.main.bc
3bf612458SYaxun (Sam) Liu; RUN: opt -module-summary %p/Inputs/noinline.ll -o %t.inputs.noinline.bc
4bf612458SYaxun (Sam) Liu; RUN: llvm-lto -thinlto -o %t.summary %t.main.bc %t.inputs.noinline.bc
5bf612458SYaxun (Sam) Liu
6bf612458SYaxun (Sam) Liu; Attempt the import now, ensure below that file containing noinline
7bf612458SYaxun (Sam) Liu; is not imported by default but imported with -force-import-all.
8bf612458SYaxun (Sam) Liu
9a9af1b9aSFangrui Song; RUN: opt -passes=function-import -summary-file %t.summary.thinlto.bc %t.main.bc -S 2>&1 \
10bf612458SYaxun (Sam) Liu; RUN:   | FileCheck -check-prefix=NOIMPORT %s
11a9af1b9aSFangrui Song; RUN: opt -passes=function-import -force-import-all -summary-file %t.summary.thinlto.bc \
12bf612458SYaxun (Sam) Liu; RUN:   %t.main.bc -S 2>&1 | FileCheck -check-prefix=IMPORT %s
13bf612458SYaxun (Sam) Liu
14bf612458SYaxun (Sam) Liudefine i32 @main() #0 {
15bf612458SYaxun (Sam) Liuentry:
16bf612458SYaxun (Sam) Liu  %f = alloca i64, align 8
17*3713bc8aSNikita Popov  call void @foo(ptr %f)
18bf612458SYaxun (Sam) Liu  ret i32 0
19bf612458SYaxun (Sam) Liu}
20bf612458SYaxun (Sam) Liu
21*3713bc8aSNikita Popov; NOIMPORT: declare void @foo(ptr)
22bf612458SYaxun (Sam) Liu; IMPORT: define available_externally void @foo
23*3713bc8aSNikita Popovdeclare void @foo(ptr) #1
24