xref: /llvm-project/llvm/test/CodeGen/ARM/2011-05-04-MultipleLandingPadSuccs.ll (revision bed1c7f061aa12417aa081e334afdba45767b938)
1; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %s -verify-machineinstrs
2
3; <rdar://problem/9187612>
4target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32-n32"
5target triple = "thumbv7-apple-darwin"
6
7define void @func() unnamed_addr align 2 personality ptr @__gxx_personality_sj0 {
8entry:
9  br label %for.cond
10
11for.cond:
12  %tmp2 = phi i32 [ 0, %entry ], [ %add, %for.cond.backedge ]
13  %cmp = icmp ult i32 %tmp2, 14
14  br i1 %cmp, label %for.body, label %for.end
15
16for.body:
17  %add = add i32 %tmp2, 1
18  switch i32 %tmp2, label %sw.default [
19    i32 0, label %sw.bb
20    i32 1, label %sw.bb
21    i32 2, label %sw.bb
22    i32 4, label %sw.bb
23    i32 5, label %sw.bb
24    i32 10, label %sw.bb
25  ]
26
27sw.bb:
28  invoke void @foo()
29          to label %invoke.cont17 unwind label %lpad
30
31invoke.cont17:
32  invoke void @foo()
33          to label %for.cond.backedge unwind label %lpad26
34
35for.cond.backedge:
36  br label %for.cond
37
38lpad:
39  %exn = landingpad { ptr, i32 }
40           catch ptr null
41  invoke void @foo()
42          to label %eh.resume unwind label %terminate.lpad
43
44lpad26:
45  %exn27 = landingpad { ptr, i32 }
46           catch ptr null
47  invoke void @foo()
48          to label %eh.resume unwind label %terminate.lpad
49
50sw.default:
51  br label %for.cond.backedge
52
53for.end:
54  invoke void @foo()
55          to label %call8.i.i.i.noexc unwind label %lpad44
56
57call8.i.i.i.noexc:
58  ret void
59
60lpad44:
61  %exn45 = landingpad { ptr, i32 }
62           catch ptr null
63  invoke void @foo()
64          to label %eh.resume unwind label %terminate.lpad
65
66eh.resume:
67  %exn.slot.0 = phi { ptr, i32 } [ %exn27, %lpad26 ], [ %exn, %lpad ], [ %exn45, %lpad44 ]
68  resume { ptr, i32 } %exn.slot.0
69
70terminate.lpad:
71  %exn51 = landingpad { ptr, i32 }
72           catch ptr null
73  tail call void @_ZSt9terminatev() noreturn nounwind
74  unreachable
75}
76
77declare void @foo()
78
79declare i32 @__gxx_personality_sj0(...)
80
81declare void @_Unwind_SjLj_Resume_or_Rethrow(ptr)
82
83declare void @_ZSt9terminatev()
84
85!0 = !{!"any pointer", !1}
86!1 = !{!"omnipotent char", !2}
87!2 = !{!"Simple C/C++ TBAA"}
88!3 = !{!"bool", !1}
89!4 = !{!"int", !1}
90