61 lines · plain
1; RUN: split-file %s %t2; RUN: opt -thinlto-bc %t/a.ll -thin-link-bitcode-file=%t1.thinlink.bc -o %t1.bc3; RUN: opt -thinlto-bc %t/b.ll -thin-link-bitcode-file=%t1.thinlink.bc -o %t2.bc4; RUN: opt -thinlto-bc %t/c.ll -thin-link-bitcode-file=%t1.thinlink.bc -o %t3.bc5 6; If the prevailing weak symbol is defined in a native file, the IR copies should be dead and propagation should not occur7; 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 \11; RUN: -save-temps12 13; RUN: llvm-dis -o - %t.o.1.3.import.bc | FileCheck %s14 15; If the prevailing weak symbol is in an IR file, it should be the one used in the final binary and thus propagation16; should be based off of that copy17; 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 \21; RUN: -save-temps22 23; RUN: llvm-dis -o - %t.2.o.1.3.import.bc | FileCheck %s --check-prefix=PREVAILING24; RUN: llvm-dis -o - %t.2.o.2.3.import.bc | FileCheck %s --check-prefix=PREVAILING-B25; RUN: llvm-dis -o - %t.2.o.3.3.import.bc | FileCheck %s --check-prefix=PREVAILING-C26 27;--- a.ll28target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"29target triple = "x86_64-unknown-linux-gnu"30 31declare i32 @callee()32 33; CHECK-NOT: Function Attrs: 34; CHECK: define i32 @caller()35 36; PREVAILING: Function Attrs: norecurse nounwind37; PREVAILING-NEXT: define i32 @caller()38define i32 @caller() {39 %res = call i32 @callee()40 ret i32 %res41}42 43;--- b.ll44target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"45target triple = "x86_64-unknown-linux-gnu"46 47; PREVAILING-B: define weak i32 @callee()48define weak i32 @callee() {49 ret i32 550}51 52;--- c.ll53target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"54target triple = "x86_64-unknown-linux-gnu"55 56; PREVAILING-C: declare i32 @callee()57define weak i32 @callee() {58 ret i32 659}60 61