blob: 397eba410b1f496ea0ad1c05b04f635f48bbd581 [file] [log] [blame]
Dan Gohman55a78772009-09-11 18:41:06 +00001; RUN: llc < %s -mtriple=arm-apple-darwin9 -march=arm | FileCheck %s
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +00002
3%struct.A = type { i32* }
4
Rafael Espindola1e819662010-06-17 15:18:27 +00005define void @"\01-[MyFunction Name:]"() {
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +00006entry:
7 %save_filt.1 = alloca i32 ; <i32*> [#uses=2]
8 %save_eptr.0 = alloca i8* ; <i8**> [#uses=2]
9 %a = alloca %struct.A ; <%struct.A*> [#uses=3]
10 %eh_exception = alloca i8* ; <i8**> [#uses=5]
11 %eh_selector = alloca i32 ; <i32*> [#uses=3]
12 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
Rafael Espindola1e819662010-06-17 15:18:27 +000013 call void @_ZN1AC1Ev(%struct.A* %a)
14 invoke void @_Z3barv()
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000015 to label %invcont unwind label %lpad
16
17invcont: ; preds = %entry
Rafael Espindola1e819662010-06-17 15:18:27 +000018 call void @_ZN1AD1Ev(%struct.A* %a) nounwind
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000019 br label %return
20
21bb: ; preds = %ppad
22 %eh_select = load i32* %eh_selector ; <i32> [#uses=1]
23 store i32 %eh_select, i32* %save_filt.1, align 4
24 %eh_value = load i8** %eh_exception ; <i8*> [#uses=1]
25 store i8* %eh_value, i8** %save_eptr.0, align 4
Rafael Espindola1e819662010-06-17 15:18:27 +000026 call void @_ZN1AD1Ev(%struct.A* %a) nounwind
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000027 %0 = load i8** %save_eptr.0, align 4 ; <i8*> [#uses=1]
28 store i8* %0, i8** %eh_exception, align 4
29 %1 = load i32* %save_filt.1, align 4 ; <i32> [#uses=1]
30 store i32 %1, i32* %eh_selector, align 4
31 br label %Unwind
32
33return: ; preds = %invcont
34 ret void
35
36lpad: ; preds = %entry
37 %eh_ptr = call i8* @llvm.eh.exception() ; <i8*> [#uses=1]
38 store i8* %eh_ptr, i8** %eh_exception
39 %eh_ptr1 = load i8** %eh_exception ; <i8*> [#uses=1]
40 %eh_select2 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr1, i8* bitcast (i32 (...)* @__gxx_personality_sj0 to i8*), i32 0) ; <i32> [#uses=1]
41 store i32 %eh_select2, i32* %eh_selector
42 br label %ppad
43
44ppad: ; preds = %lpad
45 br label %bb
46
47Unwind: ; preds = %bb
48 %eh_ptr3 = load i8** %eh_exception ; <i8*> [#uses=1]
Rafael Espindola1e819662010-06-17 15:18:27 +000049 call void @_Unwind_SjLj_Resume(i8* %eh_ptr3)
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000050 unreachable
51}
52
Rafael Espindola1e819662010-06-17 15:18:27 +000053define linkonce_odr void @_ZN1AC1Ev(%struct.A* %this) {
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000054entry:
55 %this_addr = alloca %struct.A* ; <%struct.A**> [#uses=2]
56 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
57 store %struct.A* %this, %struct.A** %this_addr
Rafael Espindola1e819662010-06-17 15:18:27 +000058 %0 = call i8* @_Znwm(i32 4) ; <i8*> [#uses=1]
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000059 %1 = bitcast i8* %0 to i32* ; <i32*> [#uses=1]
60 %2 = load %struct.A** %this_addr, align 4 ; <%struct.A*> [#uses=1]
61 %3 = getelementptr inbounds %struct.A* %2, i32 0, i32 0 ; <i32**> [#uses=1]
62 store i32* %1, i32** %3, align 4
63 br label %return
64
65return: ; preds = %entry
66 ret void
67}
68
Rafael Espindola1e819662010-06-17 15:18:27 +000069declare i8* @_Znwm(i32)
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000070
Rafael Espindola1e819662010-06-17 15:18:27 +000071define linkonce_odr void @_ZN1AD1Ev(%struct.A* %this) nounwind {
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000072entry:
73 %this_addr = alloca %struct.A* ; <%struct.A**> [#uses=2]
74 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
75 store %struct.A* %this, %struct.A** %this_addr
76 %0 = load %struct.A** %this_addr, align 4 ; <%struct.A*> [#uses=1]
77 %1 = getelementptr inbounds %struct.A* %0, i32 0, i32 0 ; <i32**> [#uses=1]
78 %2 = load i32** %1, align 4 ; <i32*> [#uses=1]
79 %3 = bitcast i32* %2 to i8* ; <i8*> [#uses=1]
Rafael Espindola1e819662010-06-17 15:18:27 +000080 call void @_ZdlPv(i8* %3) nounwind
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000081 br label %bb
82
83bb: ; preds = %entry
84 br label %return
85
86return: ; preds = %bb
87 ret void
88}
Dan Gohman9f23dee2010-04-17 16:29:15 +000089;CHECK: L_LSDA_0:
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000090
Rafael Espindola1e819662010-06-17 15:18:27 +000091declare void @_ZdlPv(i8*) nounwind
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000092
Rafael Espindola1e819662010-06-17 15:18:27 +000093declare void @_Z3barv()
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +000094
95declare i8* @llvm.eh.exception() nounwind
96
97declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind
98
99declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind
100
Rafael Espindola1e819662010-06-17 15:18:27 +0000101declare i32 @__gxx_personality_sj0(...)
Jim Grosbach3fb2b1e2009-09-01 01:57:56 +0000102
Rafael Espindola1e819662010-06-17 15:18:27 +0000103declare void @_Unwind_SjLj_Resume(i8*)