1; RUN: opt -module-summary %s -o %t1.bc
2; RUN: opt -module-summary %p/Inputs/linkonce_aliasee_ref_import.ll -o %t2.bc
3
4; Import with instr limit to ensure only foo imported.
5; RUN: llvm-lto -thinlto-action=run -exported-symbol=main -import-instr-limit=5 %t1.bc %t2.bc
6; RUN: llvm-nm -o - < %t1.bc.thinlto.o | FileCheck %s --check-prefix=NM1
7; RUN: llvm-nm -o - < %t2.bc.thinlto.o | FileCheck %s --check-prefix=NM2
8
9; Import with instr limit to ensure only foo imported.
10; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
11; RUN:    -r=%t1.bc,foo,pxl \
12; RUN:    -r=%t1.bc,baz,pxl \
13; RUN:    -r=%t1.bc,baz.clone,pxl \
14; RUN:    -r=%t1.bc,bar,pl \
15; RUN:    -r=%t2.bc,main,pxl \
16; RUN:    -r=%t2.bc,foo,l \
17; RUN:    -import-instr-limit=5
18; RUN: llvm-nm -o - < %t1.bc.thinlto.o | FileCheck %s --check-prefix=NM1
19; RUN: llvm-nm -o - < %t2.bc.thinlto.o | FileCheck %s --check-prefix=NM2
20
21; Check that we converted baz.clone to a weak
22; NM1: W baz.clone
23
24; Check that we imported a ref (and not def) to baz.clone
25; NM2: U baz.clone
26
27target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
28target triple = "x86_64-grtev4-linux-gnu"
29
30$baz.clone = comdat any
31@baz = weak alias void (), void ()* @baz.clone
32
33define void @foo() #5 align 2 {
34  tail call void @baz.clone()
35  ret void
36}
37define linkonce_odr void @baz.clone() #5 comdat align 2 {
38  call void @bar()
39  call void @bar()
40  call void @bar()
41  call void @bar()
42  call void @bar()
43  call void @bar()
44  call void @bar()
45  ret void
46}
47
48define void @bar() {
49  ret void
50}
51