1 ; RUN: opt -S -passes=mergefunc < %s | FileCheck %s
3 ; CHECK-LABEL: define i32 @func1
4 ; CHECK: call i32 @func2
7 ; CHECK-LABEL: define i32 @func2
8 ; CHECK: call i32 @unknown
11 ; CHECK-LABEL: define i32 @func4
12 ; CHECK: call i32 @func2
15 ; CHECK-LABEL: define weak i32 @func3_weak
16 ; CHECK: call i32 @func1
19 define i32 @func1(i32 %x, i32 %y) {
21 %sum2 = add i32 %sum, %y
22 %sum3 = call i32 @func4(i32 %sum, i32 %sum2)
26 define i32 @func4(i32 %x, i32 %y) {
28 %sum2 = add i32 %sum, %y
29 %sum3 = call i32 @unknown(i32 %sum, i32 %sum2)
33 define weak i32 @func3_weak(i32 %x, i32 %y) {
35 %sum2 = add i32 %sum, %y
36 %sum3 = call i32 @func2(i32 %sum, i32 %sum2)
40 define i32 @func2(i32 %x, i32 %y) {
42 %sum2 = add i32 %sum, %y
43 %sum3 = call i32 @unknown(i32 %sum, i32 %sum2)
47 declare i32 @unknown(i32 %x, i32 %y)