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 \ 12; RUN: -save-temps 13; RUN: llvm-dis -o - %t.o.1.3.import.bc | FileCheck %s --match-full-lines 14 15;--- main.ll 16target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 17target triple = "x86_64-unknown-linux-gnu" 18 19declare void @caller() 20declare void @caller_noattr() 21 22; CHECK: define void @importer() [[ATTR_PROP:#[0-9]+]] { 23define void @importer() { 24 call void @caller() 25 ret void 26} 27 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() { 31define void @importer_noattr() { 32 call void @caller_noattr() 33 ret void 34} 35 36; CHECK: define available_externally hidden void @callee{{.*}} 37 38; CHECK-DAG: attributes [[ATTR_PROP]] = { norecurse nounwind } 39 40;--- callees.ll 41target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 42target triple = "x86_64-unknown-linux-gnu" 43 44attributes #0 = { nounwind norecurse } 45 46define void @caller() #0 { 47 call void @callee() 48 ret void 49} 50 51define void @caller_noattr() { 52 call void @callee() 53 ret void 54} 55 56define internal void @callee() #0 { 57 ret void 58} 59