1; RUN: opt -S -passes=mergefunc < %s | FileCheck %s 2 3; We should normalize to test2 rather than test1, 4; because it allows us to drop test1 entirely 5 6; CHECK-NOT: define internal void @test1() unnamed_addr 7; CHECK: define void @test3() unnamed_addr 8; CHECK-NEXT: call void @test2() 9; CHECK-NEXT: call void @test2() 10 11declare void @dummy() 12 13define internal void @test1() unnamed_addr { 14 call void @dummy() 15 call void @dummy() 16 ret void 17} 18 19define void @test2() unnamed_addr { 20 call void @dummy() 21 call void @dummy() 22 ret void 23} 24 25define void @test3() unnamed_addr { 26 call void @test1() 27 call void @test2() 28 ret void 29} 30 31; We should normalize to the existing test6 rather than 32; to a new anonymous strong backing function 33 34; CHECK: define weak void @test5() 35; CHECK-NEXT: tail call void @test6() 36; CHECK: define weak void @test4() 37; CHECK-NEXT: tail call void @test6() 38 39declare void @dummy2() 40 41define weak void @test4() { 42 call void @dummy2() 43 call void @dummy2() 44 ret void 45} 46define weak void @test5() { 47 call void @dummy2() 48 call void @dummy2() 49 ret void 50} 51define void @test6() { 52 call void @dummy2() 53 call void @dummy2() 54 ret void 55} 56