1; REQUIRES: x86-registered-target 2 3; Test that FunctionAttr Propagation is generating correct summaries 4 5; RUN: split-file %s %t 6; RUN: opt -module-summary %t/a.ll -o %t/a.bc 7; RUN: opt -module-summary %t/b.ll -o %t/b.bc 8 9; RUN: llvm-lto2 run -disable-thinlto-funcattrs=0 %t/a.bc %t/b.bc -o %t1.o -save-temps \ 10; RUN: -r=%t/a.bc,call_extern,plx \ 11; RUN: -r=%t/a.bc,extern, \ 12; RUN: -r=%t/b.bc,extern,p 13 14; RUN: llvm-dis %t1.o.index.bc -o - | FileCheck %s --check-prefix=CHECK-INDEX 15; RUN: llvm-dis %t1.o.1.1.promote.bc -o - | FileCheck %s --check-prefix=CHECK-IR 16 17;; Summary for call_extern. Note that llvm-lto2 writes out the index before propagation occurs so call_extern doesn't have its flags updated. 18; CHECK-INDEX: ^2 = gv: (guid: 13959900437860518209, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 1, dsoLocal: 1, canAutoHide: 0, importType: definition), insts: 2, calls: ((callee: ^3))))) 19;; Summary for extern 20; CHECK-INDEX: ^3 = gv: (guid: 14959766916849974397, summaries: (function: (module: ^1, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 1, dsoLocal: 0, canAutoHide: 0, importType: definition), insts: 1, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 1, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 1, mayThrow: 0, hasUnknownCall: 0, mustBeUnreachable: 0)))) 21 22;--- a.ll 23target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 24target triple = "x86_64-unknown-linux-gnu" 25 26declare void @extern() 27 28; CHECK-IR: Function Attrs: norecurse nounwind 29; CHECK-IR-NEXT: define dso_local void @call_extern() 30define void @call_extern() { 31 call void @extern() 32 ret void 33} 34 35;--- b.ll 36target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 37target triple = "x86_64-unknown-linux-gnu" 38 39attributes #0 = { nounwind norecurse } 40 41define void @extern() #0 { 42 ret void 43} 44