1; RUN: llc < %s -mtriple=armv7-apple-ios | FileCheck %s
2; This testcase makes sure we can handle invoke @llvm.donothing without
3; assertion failure.
4; <rdar://problem/13228754> & <rdar://problem/13316637>
5
6; CHECK: .globl  _foo
7define void @foo() personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) {
8invoke.cont:
9  invoke void @callA()
10          to label %invoke.cont25 unwind label %lpad2
11invoke.cont25:
12  invoke void @llvm.donothing()
13          to label %invoke.cont27 unwind label %lpad15
14
15invoke.cont27:
16  invoke void @callB()
17          to label %invoke.cont75 unwind label %lpad15
18
19invoke.cont75:
20  ret void
21
22lpad2:
23  %0 = landingpad { i8*, i32 }
24          cleanup
25  br label %eh.resume
26
27lpad15:
28  %1 = landingpad { i8*, i32 }
29          cleanup
30  br label %eh.resume
31
32eh.resume:
33  resume { i8*, i32 } zeroinitializer
34}
35
36; CHECK: .globl _bar
37define linkonce_odr void @bar(i32* %a) personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) {
38if.end.i.i.i:
39  invoke void @llvm.donothing()
40          to label %call.i.i.i.noexc unwind label %eh.resume
41
42call.i.i.i.noexc:
43  br i1 false, label %cleanup, label %new.notnull.i.i
44
45new.notnull.i.i:
46  br label %cleanup
47
48cleanup:
49  %0 = load i32, i32* %a, align 4
50  %inc294 = add nsw i32 %0, 4
51  store i32 %inc294, i32* %a, align 4
52  br i1 false, label %_ZN3lol5ArrayIivvvvvvvED1Ev.exit, label %delete.notnull.i.i.i1409
53
54delete.notnull.i.i.i1409:
55  br label %_ZN3lol5ArrayIivvvvvvvED1Ev.exit
56
57_ZN3lol5ArrayIivvvvvvvED1Ev.exit:
58  ret void
59
60eh.resume:
61  %1 = landingpad { i8*, i32 }
62          cleanup
63  %2 = extractvalue { i8*, i32 } %1, 0
64  %3 = extractvalue { i8*, i32 } %1, 1
65  %lpad.val = insertvalue { i8*, i32 } undef, i8* %2, 0
66  %lpad.val395 = insertvalue { i8*, i32 } %lpad.val, i32 %3, 1
67  resume { i8*, i32 } %lpad.val395
68}
69
70declare void @callA()
71declare void @callB()
72declare void @llvm.donothing() nounwind readnone
73declare i32 @__gxx_personality_sj0(...)
74