1; RUN: llc < %s -mtriple=arm-apple-darwin9 | FileCheck %s
2
3; CHECK: ldr r0, [[CPI_PERSONALITY:[A-Za-z0-9_]+]]
4; CHECK: ldr r0, [[CPI_LSDA:[A-Za-z0-9_]+]]
5; CHECK: [[CPI_LSDA]]:
6; CHECK: .long  [[LSDA_LABEL:[A-Za-z0-9_]+]]-
7; CHECK: [[LSDA_LABEL]]:
8; CHECK: .byte   255                     @ @LPStart Encoding = omit
9
10%struct.A = type { i32* }
11
12define void @"\01-[MyFunction Name:]"() personality i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*) {
13entry:
14  %save_filt.1 = alloca i32
15  %save_eptr.0 = alloca i8*
16  %a = alloca %struct.A
17  %eh_exception = alloca i8*
18  %eh_selector = alloca i32
19  %"alloca point" = bitcast i32 0 to i32
20  call void @_ZN1AC1Ev(%struct.A* %a)
21  invoke void @_Z3barv()
22          to label %invcont unwind label %lpad
23
24invcont:                                          ; preds = %entry
25  call void @_ZN1AD1Ev(%struct.A* %a) nounwind
26  br label %return
27
28bb:                                               ; preds = %ppad
29  %eh_select = load i32, i32* %eh_selector
30  store i32 %eh_select, i32* %save_filt.1, align 4
31  %eh_value = load i8*, i8** %eh_exception
32  store i8* %eh_value, i8** %save_eptr.0, align 4
33  call void @_ZN1AD1Ev(%struct.A* %a) nounwind
34  %0 = load i8*, i8** %save_eptr.0, align 4
35  store i8* %0, i8** %eh_exception, align 4
36  %1 = load i32, i32* %save_filt.1, align 4
37  store i32 %1, i32* %eh_selector, align 4
38  br label %Unwind
39
40return:                                           ; preds = %invcont
41  ret void
42
43lpad:                                             ; preds = %entry
44  %exn = landingpad {i8*, i32}
45           cleanup
46  %eh_ptr = extractvalue {i8*, i32} %exn, 0
47  store i8* %eh_ptr, i8** %eh_exception
48  %eh_select2 = extractvalue {i8*, i32} %exn, 1
49  store i32 %eh_select2, i32* %eh_selector
50  br label %ppad
51
52ppad:                                             ; preds = %lpad
53  br label %bb
54
55Unwind:                                           ; preds = %bb
56  %eh_ptr3 = load i8*, i8** %eh_exception
57  call void @_Unwind_SjLj_Resume(i8* %eh_ptr3)
58  unreachable
59}
60
61define linkonce_odr void @_ZN1AC1Ev(%struct.A* %this) {
62entry:
63  %this_addr = alloca %struct.A*
64  %"alloca point" = bitcast i32 0 to i32
65  store %struct.A* %this, %struct.A** %this_addr
66  %0 = call i8* @_Znwm(i32 4)
67  %1 = bitcast i8* %0 to i32*
68  %2 = load %struct.A*, %struct.A** %this_addr, align 4
69  %3 = getelementptr inbounds %struct.A, %struct.A* %2, i32 0, i32 0
70  store i32* %1, i32** %3, align 4
71  br label %return
72
73return:                                           ; preds = %entry
74  ret void
75}
76
77declare i8* @_Znwm(i32)
78
79define linkonce_odr void @_ZN1AD1Ev(%struct.A* %this) nounwind {
80entry:
81  %this_addr = alloca %struct.A*
82  %"alloca point" = bitcast i32 0 to i32
83  store %struct.A* %this, %struct.A** %this_addr
84  %0 = load %struct.A*, %struct.A** %this_addr, align 4
85  %1 = getelementptr inbounds %struct.A, %struct.A* %0, i32 0, i32 0
86  %2 = load i32*, i32** %1, align 4
87  %3 = bitcast i32* %2 to i8*
88  call void @_ZdlPv(i8* %3) nounwind
89  br label %bb
90
91bb:                                               ; preds = %entry
92  br label %return
93
94return:                                           ; preds = %bb
95  ret void
96}
97
98declare void @_ZdlPv(i8*) nounwind
99
100declare void @_Z3barv()
101
102declare i32 @llvm.eh.typeid.for(i8*) nounwind
103
104declare i32 @__gxx_personality_sj0(...)
105
106declare void @_Unwind_SjLj_Resume(i8*)
107