1*d047dbd9Seleviant; RUN: llvm-as %s -o %t.bc 2*d047dbd9Seleviant; RUN: llvm-as %p/Inputs/merge-functions-foo.ll -o %t-foo.bc 3*d047dbd9Seleviant; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \ 4*d047dbd9Seleviant; RUN: -m elf_x86_64 \ 5*d047dbd9Seleviant; RUN: -plugin-opt=merge-functions \ 6*d047dbd9Seleviant; RUN: -plugin-opt=save-temps \ 7*d047dbd9Seleviant; RUN: -u main \ 8*d047dbd9Seleviant; RUN: %t.bc %t-foo.bc \ 9*d047dbd9Seleviant; RUN: -o %t-out 10*d047dbd9Seleviant; RUN: llvm-dis %t-out.0.5.precodegen.bc -o - | FileCheck %s 11*d047dbd9Seleviant 12*d047dbd9Seleviant; Check that we've merged foo and bar 13*d047dbd9Seleviant; CHECK: define dso_local noundef i32 @main() 14*d047dbd9Seleviant; CHECK-NEXT: tail call fastcc void @bar() 15*d047dbd9Seleviant; CHECK-NEXT: tail call fastcc void @bar() 16*d047dbd9Seleviant 17*d047dbd9Selevianttarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" 18*d047dbd9Selevianttarget triple = "x86_64-pc-linux-gnu" 19*d047dbd9Seleviant 20*d047dbd9Seleviant@_g = external local_unnamed_addr global i32, align 4 21*d047dbd9Seleviant 22*d047dbd9Seleviantdefine dso_local i32 @bar(i32 noundef %0) #0 { 23*d047dbd9Seleviant %2 = add nsw i32 %0, 42 24*d047dbd9Seleviant store i32 %2, ptr @_g, align 4 25*d047dbd9Seleviant ret i32 %2 26*d047dbd9Seleviant} 27*d047dbd9Seleviant 28*d047dbd9Seleviantdefine dso_local noundef i32 @main() { 29*d047dbd9Seleviant %1 = tail call i32 @foo(i32 noundef 1) 30*d047dbd9Seleviant %2 = tail call i32 @bar(i32 noundef 1) 31*d047dbd9Seleviant ret i32 0 32*d047dbd9Seleviant} 33*d047dbd9Seleviant 34*d047dbd9Seleviantdeclare i32 @foo(i32 noundef) local_unnamed_addr #2 35*d047dbd9Seleviant 36*d047dbd9Seleviantattributes #0 = { noinline } 37*d047dbd9Seleviant 38*d047dbd9Seleviant!llvm.module.flags = !{!0, !1} 39*d047dbd9Seleviant 40*d047dbd9Seleviant!0 = !{i32 1, !"ThinLTO", i32 0} 41*d047dbd9Seleviant!1 = !{i32 1, !"EnableSplitLTOUnit", i32 1} 42*d047dbd9Seleviant 43*d047dbd9Seleviant^0 = module: (path: "merge-functions.o", hash: (0, 0, 0, 0, 0)) 44*d047dbd9Seleviant^1 = gv: (name: "foo") ; guid = 6699318081062747564 45*d047dbd9Seleviant^2 = gv: (name: "_g") ; guid = 9713702464056781075 46*d047dbd9Seleviant^3 = gv: (name: "main", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 1, live: 0, dsoLocal: 1, canAutoHide: 0), insts: 3, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 1, mayThrow: 0, hasUnknownCall: 0, mustBeUnreachable: 0), calls: ((callee: ^1, tail: 1), (callee: ^4, tail: 1))))) ; guid = 15822663052811949562 47*d047dbd9Seleviant^4 = gv: (name: "bar", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 1, live: 0, dsoLocal: 1, canAutoHide: 0), insts: 3, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 1, returnDoesNotAlias: 0, noInline: 1, alwaysInline: 0, noUnwind: 1, mayThrow: 0, hasUnknownCall: 0, mustBeUnreachable: 0), refs: (^2)))) ; guid = 16434608426314478903 48*d047dbd9Seleviant^5 = flags: 8 49*d047dbd9Seleviant^6 = blockcount: 0 50