blob: 4981b33db94d52d6466032cb5efd7ca1910670ca [file] [log] [blame]
Eric Christophercee313d2019-04-17 04:52:47 +00001; RUN: opt -S -mergefunc < %s | FileCheck %s
2
Fangrui Song884f5572019-04-19 07:57:51 +00003; After the merge of test5 and test6, we can merge test3 and test4,
4; then test1 and test2.
Eric Christophercee313d2019-04-17 04:52:47 +00005
Fangrui Song884f5572019-04-19 07:57:51 +00006; CHECK: define void @test6() unnamed_addr
7; CHECK-NEXT: tail call void @test5()
Eric Christophercee313d2019-04-17 04:52:47 +00008; CHECK: define void @test4() unnamed_addr
9; CHECK-NEXT: tail call void @test3()
10; CHECK: define void @test2() unnamed_addr
11; CHECK-NEXT: tail call void @test1()
12
13declare void @dummy()
Fangrui Song884f5572019-04-19 07:57:51 +000014
Eric Christophercee313d2019-04-17 04:52:47 +000015define void @test1() unnamed_addr {
16 call void @test3()
17 call void @test3()
18 ret void
19}
20
21define void @test2() unnamed_addr {
22 call void @test4()
23 call void @test4()
24 ret void
25}
26
27define void @test3() unnamed_addr {
Fangrui Song884f5572019-04-19 07:57:51 +000028 call void @test5()
29 call void @test5()
30 ret void
31}
32
33define void @test4() unnamed_addr {
34 call void @test6()
35 call void @test6()
36 ret void
37}
38
39define void @test5() unnamed_addr {
Eric Christophercee313d2019-04-17 04:52:47 +000040 call void @dummy()
41 call void @dummy()
42 ret void
43}
44
Fangrui Song884f5572019-04-19 07:57:51 +000045define void @test6() unnamed_addr {
Eric Christophercee313d2019-04-17 04:52:47 +000046 call void @dummy()
47 call void @dummy()
48 ret void
49}