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