1; RUN: opt -module-summary %s -o %t_main.bc
2; RUN: opt -module-summary %p/Inputs/select_right_alias_definition1.ll -o %t1.bc
3; RUN: opt -module-summary %p/Inputs/select_right_alias_definition2.ll -o %t2.bc
4
5; Make sure that we always select the right definition for alia foo, whatever
6; order the files are linked in.
7
8; Try with one order
9; RUN: llvm-lto -thinlto-action=thinlink -o %t.index1.bc %t_main.bc %t1.bc %t2.bc
10; RUN: llvm-lto -thinlto-action=import -thinlto-index %t.index1.bc %t_main.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=IMPORT
11
12; Try with the other order (reversing %t1.bc and %t2.bc)
13; RUN: llvm-lto -thinlto-action=thinlink -o %t.index2.bc %t_main.bc %t2.bc %t1.bc
14; RUN: llvm-lto -thinlto-action=import -thinlto-index %t.index2.bc %t_main.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=IMPORT
15
16; IMPORT: @foo = alias i32 (...), bitcast (i32 ()* @foo2 to i32 (...)*)
17; IMPORT: define linkonce_odr i32 @foo2() {
18; IMPORT-NEXT:  %ret = add i32 42, 42
19; IMPORT-NEXT:  ret i32 %ret
20; IMPORT-NEXT: }
21
22declare i32 @foo()
23
24define i32 @main() {
25    %ret = call i32 @foo()
26    ret i32 %ret
27}