1 ; RUN: split-file %s %t
2 ; RUN: opt -thinlto-bc %t/a.ll -thin-link-bitcode-file=%t1.thinlink.bc -o %t1.bc
3 ; RUN: opt -thinlto-bc %t/b.ll -thin-link-bitcode-file=%t1.thinlink.bc -o %t2.bc
4 ; RUN: opt -thinlto-bc %t/c.ll -thin-link-bitcode-file=%t1.thinlink.bc -o %t3.bc
6 ; If the prevailing weak symbol is defined in a native file, the IR copies should be dead and propagation should not occur
7 ; RUN: llvm-lto2 run -disable-thinlto-funcattrs=0 %t1.bc %t2.bc %t3.bc -o %t.o \
8 ; RUN: -r %t1.bc,caller,px -r %t1.bc,callee,lx \
9 ; RUN: -r %t2.bc,callee,x \
10 ; RUN: -r %t3.bc,callee,x \
13 ; RUN: llvm-dis -o - %t.o.1.3.import.bc | FileCheck %s
15 ; If the prevailing weak symbol is in an IR file, it should be the one used in the final binary and thus propagation
16 ; should be based off of that copy
17 ; RUN: llvm-lto2 run -O3 -disable-thinlto-funcattrs=0 %t1.bc %t2.bc %t3.bc -o %t.2.o \
18 ; RUN: -r %t1.bc,caller,px -r %t1.bc,callee,lx \
19 ; RUN: -r %t2.bc,callee,px \
20 ; RUN: -r %t3.bc,callee,x \
23 ; RUN: llvm-dis -o - %t.2.o.1.3.import.bc | FileCheck %s --check-prefix=PREVAILING
24 ; RUN: llvm-dis -o - %t.2.o.2.3.import.bc | FileCheck %s --check-prefix=PREVAILING-B
25 ; RUN: llvm-dis -o - %t.2.o.3.3.import.bc | FileCheck %s --check-prefix=PREVAILING-C
28 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
29 target triple = "x86_64-unknown-linux-gnu"
33 ; CHECK-NOT: Function Attrs:
34 ; CHECK: define i32 @caller()
36 ; PREVAILING: Function Attrs: norecurse nounwind
37 ; PREVAILING-NEXT: define i32 @caller()
38 define i32 @caller() {
39 %res = call i32 @callee()
44 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
45 target triple = "x86_64-unknown-linux-gnu"
47 ; PREVAILING-B: define weak i32 @callee()
48 define weak i32 @callee() {
53 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
54 target triple = "x86_64-unknown-linux-gnu"
56 ; PREVAILING-C: declare i32 @callee()
57 define weak i32 @callee() {