1; RUN: llc < %s -O0 -mtriple=thumbv7-apple-ios | FileCheck %s
2
3; Radar 10567930: Make sure that all the caller-saved registers are saved and
4; restored in a function with setjmp/longjmp EH.  In particular, r6 was not
5; being saved here.
6; CHECK: push {r4, r5, r6, r7, lr}
7
8%0 = type opaque
9%struct.NSConstantString = type { i32*, i32, i8*, i32 }
10
11define i32 @asdf(i32 %a, i32 %b, i8** %c, i8* %d) {
12bb:
13  %tmp = alloca i32, align 4
14  %tmp1 = alloca i32, align 4
15  %tmp2 = alloca i8*, align 4
16  %tmp3 = alloca i1
17  %myException = alloca %0*, align 4
18  %tmp4 = alloca i8*
19  %tmp5 = alloca i32
20  %exception = alloca %0*, align 4
21  store i32 %a, i32* %tmp, align 4
22  store i32 %b, i32* %tmp1, align 4
23  store i8* %d, i8** %tmp2, align 4
24  store i1 false, i1* %tmp3
25  %tmp7 = load i8** %c
26  %tmp10 = invoke %0* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %0* (i8*, i8*, %0*)*)(i8* %tmp7, i8* %d, %0* null)
27          to label %bb11 unwind label %bb15
28
29bb11:                                             ; preds = %bb
30  store %0* %tmp10, %0** %myException, align 4
31  %tmp12 = load %0** %myException, align 4
32  %tmp13 = bitcast %0* %tmp12 to i8*
33  invoke void @objc_exception_throw(i8* %tmp13) noreturn
34          to label %bb14 unwind label %bb15
35
36bb14:                                             ; preds = %bb11
37  unreachable
38
39bb15:                                             ; preds = %bb11, %bb
40  %tmp16 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*)
41          catch i8* null
42  %tmp17 = extractvalue { i8*, i32 } %tmp16, 0
43  store i8* %tmp17, i8** %tmp4
44  %tmp18 = extractvalue { i8*, i32 } %tmp16, 1
45  store i32 %tmp18, i32* %tmp5
46  store i1 true, i1* %tmp3
47  br label %bb56
48
49bb56:
50  unreachable
51}
52
53declare i8* @objc_msgSend(i8*, i8*, ...) nonlazybind
54declare i32 @__objc_personality_v0(...)
55declare void @objc_exception_throw(i8*)
56