1 ; Function import can promote an internal function to external but not mark it as prevailing.
2 ; Given that the internal function's attributes would have already propagated to its callers
3 ; that are part of the import chain there's no need to actually propagate off this copy as
4 ; propagating the caller performs the same thing.
5 ; RUN: split-file %s %t
6 ; RUN: opt -thinlto-bc %t/main.ll -thin-link-bitcode-file=%t1.thinlink.bc -o %t1.bc
7 ; RUN: opt -thinlto-bc %t/callees.ll -thin-link-bitcode-file=%t2.thinlink.bc -o %t2.bc
8 ; RUN: llvm-lto2 run -disable-thinlto-funcattrs=0 \
9 ; RUN: %t1.bc %t2.bc -o %t.o \
10 ; RUN: -r %t1.bc,caller,l -r %t1.bc,caller_noattr,l -r %t1.bc,importer,px -r %t1.bc,importer_noattr,px \
11 ; RUN: -r %t2.bc,caller,px -r %t2.bc,caller_noattr,px \
13 ; RUN: llvm-dis -o - %t.o.1.3.import.bc | FileCheck %s --match-full-lines
16 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
17 target triple = "x86_64-unknown-linux-gnu"
19 declare void @caller()
20 declare void @caller_noattr()
22 ; CHECK: define void @importer() [[ATTR_PROP:#[0-9]+]] {
23 define void @importer() {
28 ; If somehow the caller doesn't get the attributes, we
29 ; shouldn't propagate from the internal callee.
30 ; CHECK: define void @importer_noattr() {
31 define void @importer_noattr() {
32 call void @caller_noattr()
36 ; CHECK: define available_externally hidden void @callee{{.*}}
38 ; CHECK-DAG: attributes [[ATTR_PROP]] = { norecurse nounwind }
41 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
42 target triple = "x86_64-unknown-linux-gnu"
44 attributes #0 = { nounwind norecurse }
46 define void @caller() #0 {
51 define void @caller_noattr() {
56 define internal void @callee() #0 {