xref: /llvm-project/llvm/test/Transforms/FunctionImport/funcimport_alias.ll (revision a9af1b9a307780a39facd016c7329990d6cc5508)
1cee313d2SEric Christopher; Do setup work for all below tests: generate bitcode and combined index
2cee313d2SEric Christopher; RUN: opt -module-summary %s -o %t.bc
3cee313d2SEric Christopher; RUN: opt -module-summary %p/Inputs/funcimport_alias.ll -o %t2.bc
4cee313d2SEric Christopher; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc
5cee313d2SEric Christopher
6cee313d2SEric Christopher; Do the import now. Ensures that the importer handles an external call
7cee313d2SEric Christopher; from imported callanalias() to a function that is defined already in
8cee313d2SEric Christopher; the dest module, but as an alias.
9*a9af1b9aSFangrui Song; RUN: opt -passes=function-import -summary-file %t3.thinlto.bc %t.bc -S | FileCheck %s
10cee313d2SEric Christopher
11cee313d2SEric Christopherdefine i32 @main() #0 {
12cee313d2SEric Christopherentry:
13cee313d2SEric Christopher  call void @callanalias()
14cee313d2SEric Christopher  ret i32 0
15cee313d2SEric Christopher}
16cee313d2SEric Christopher
1741d5033eSNikita Popov@analias = alias void (), ptr @globalfunc
18cee313d2SEric Christopher
19cee313d2SEric Christopherdefine void @globalfunc() #0 {
20cee313d2SEric Christopherentry:
21cee313d2SEric Christopher  ret void
22cee313d2SEric Christopher}
23cee313d2SEric Christopher
24cee313d2SEric Christopherdeclare void @callanalias() #1
25cee313d2SEric Christopher; CHECK-DAG: define available_externally void @callanalias()
26