1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-windows-gnu | FileCheck %s --check-prefix=CHECK-MINGW-X86
4 %struct.as = type { i32* }
6 @_ZZ2amiE2au = internal unnamed_addr global %struct.as zeroinitializer, align 4
7 @_ZGVZ2amiE2au = internal global i64 0, align 8
8 @_ZTIi = external constant i8*
10 define void @_Z2ami(i32) #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
11 ; CHECK-MINGW-X86-LABEL: _Z2ami:
12 ; CHECK-MINGW-X86: # %bb.0: # %entry
13 ; CHECK-MINGW-X86-NEXT: pushl %edi
14 ; CHECK-MINGW-X86-NEXT: .cfi_def_cfa_offset 8
15 ; CHECK-MINGW-X86-NEXT: pushl %esi
16 ; CHECK-MINGW-X86-NEXT: .cfi_def_cfa_offset 12
17 ; CHECK-MINGW-X86-NEXT: .cfi_offset %esi, -12
18 ; CHECK-MINGW-X86-NEXT: .cfi_offset %edi, -8
19 ; CHECK-MINGW-X86-NEXT: movb __ZGVZ2amiE2au, %al
20 ; CHECK-MINGW-X86-NEXT: testb %al, %al
21 ; CHECK-MINGW-X86-NEXT: jne LBB0_4
22 ; CHECK-MINGW-X86-NEXT: # %bb.1: # %init.check
23 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x04
24 ; CHECK-MINGW-X86-NEXT: pushl $__ZGVZ2amiE2au
25 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
26 ; CHECK-MINGW-X86-NEXT: calll ___cxa_guard_acquire
27 ; CHECK-MINGW-X86-NEXT: addl $4, %esp
28 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset -4
29 ; CHECK-MINGW-X86-NEXT: testl %eax, %eax
30 ; CHECK-MINGW-X86-NEXT: je LBB0_4
31 ; CHECK-MINGW-X86-NEXT: # %bb.2: # %init
32 ; CHECK-MINGW-X86-NEXT: Ltmp0:
33 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x04
34 ; CHECK-MINGW-X86-NEXT: pushl $4
35 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
36 ; CHECK-MINGW-X86-NEXT: calll __Znwj
37 ; CHECK-MINGW-X86-NEXT: addl $4, %esp
38 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset -4
39 ; CHECK-MINGW-X86-NEXT: Ltmp1:
40 ; CHECK-MINGW-X86-NEXT: # %bb.3: # %invoke.cont
41 ; CHECK-MINGW-X86-NEXT: movl %eax, __ZZ2amiE2au
42 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x04
43 ; CHECK-MINGW-X86-NEXT: pushl $__ZGVZ2amiE2au
44 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
45 ; CHECK-MINGW-X86-NEXT: calll ___cxa_guard_release
46 ; CHECK-MINGW-X86-NEXT: addl $4, %esp
47 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset -4
48 ; CHECK-MINGW-X86-NEXT: LBB0_4: # %init.end
49 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x04
50 ; CHECK-MINGW-X86-NEXT: pushl $4
51 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
52 ; CHECK-MINGW-X86-NEXT: calll __Znwj
53 ; CHECK-MINGW-X86-NEXT: addl $4, %esp
54 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset -4
55 ; CHECK-MINGW-X86-NEXT: movl %eax, %esi
56 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x04
57 ; CHECK-MINGW-X86-NEXT: pushl $4
58 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
59 ; CHECK-MINGW-X86-NEXT: calll ___cxa_allocate_exception
60 ; CHECK-MINGW-X86-NEXT: addl $4, %esp
61 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset -4
62 ; CHECK-MINGW-X86-NEXT: movl $0, (%eax)
63 ; CHECK-MINGW-X86-NEXT: Ltmp3:
64 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x0c
65 ; CHECK-MINGW-X86-NEXT: movl .refptr.__ZTIi, %ecx
66 ; CHECK-MINGW-X86-NEXT: pushl $0
67 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
68 ; CHECK-MINGW-X86-NEXT: pushl %ecx
69 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
70 ; CHECK-MINGW-X86-NEXT: pushl %eax
71 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
72 ; CHECK-MINGW-X86-NEXT: calll ___cxa_throw
73 ; CHECK-MINGW-X86-NEXT: addl $12, %esp
74 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset -12
75 ; CHECK-MINGW-X86-NEXT: Ltmp4:
76 ; CHECK-MINGW-X86-NEXT: # %bb.8: # %unreachable
77 ; CHECK-MINGW-X86-NEXT: LBB0_5: # %lpad
78 ; CHECK-MINGW-X86-NEXT: Ltmp2:
79 ; CHECK-MINGW-X86-NEXT: movl %eax, %edi
80 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x04
81 ; CHECK-MINGW-X86-NEXT: pushl $__ZGVZ2amiE2au
82 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
83 ; CHECK-MINGW-X86-NEXT: calll ___cxa_guard_abort
84 ; CHECK-MINGW-X86-NEXT: jmp LBB0_7
85 ; CHECK-MINGW-X86-NEXT: LBB0_6: # %lpad1
86 ; CHECK-MINGW-X86-NEXT: .cfi_def_cfa_offset 12
87 ; CHECK-MINGW-X86-NEXT: Ltmp5:
88 ; CHECK-MINGW-X86-NEXT: movl %eax, %edi
89 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x04
90 ; CHECK-MINGW-X86-NEXT: pushl %esi
91 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
92 ; CHECK-MINGW-X86-NEXT: calll __ZdlPv
93 ; CHECK-MINGW-X86-NEXT: LBB0_7: # %eh.resume
94 ; CHECK-MINGW-X86-NEXT: addl $4, %esp
95 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset -4
96 ; CHECK-MINGW-X86-NEXT: .cfi_escape 0x2e, 0x04
97 ; CHECK-MINGW-X86-NEXT: pushl %edi
98 ; CHECK-MINGW-X86-NEXT: .cfi_adjust_cfa_offset 4
99 ; CHECK-MINGW-X86-NEXT: calll __Unwind_Resume
100 ; CHECK-MINGW-X86-NEXT: Lfunc_end0:
102 %1 = load atomic i8, i8* bitcast (i64* @_ZGVZ2amiE2au to i8*) acquire, align 8
103 %guard.uninitialized = icmp eq i8 %1, 0
104 br i1 %guard.uninitialized, label %init.check, label %init.end
106 init.check: ; preds = %entry
107 %2 = tail call i32 @__cxa_guard_acquire(i64* nonnull @_ZGVZ2amiE2au)
108 %tobool = icmp eq i32 %2, 0
109 br i1 %tobool, label %init.end, label %init
111 init: ; preds = %init.check
112 %call.i3 = invoke i8* @_Znwj(i32 4)
113 to label %invoke.cont unwind label %lpad
115 invoke.cont: ; preds = %init
116 store i8* %call.i3, i8** bitcast (%struct.as* @_ZZ2amiE2au to i8**), align 4
117 tail call void @__cxa_guard_release(i64* nonnull @_ZGVZ2amiE2au)
120 init.end: ; preds = %init.check, %invoke.cont, %entry
121 %call.i = tail call i8* @_Znwj(i32 4)
122 %exception = tail call i8* @__cxa_allocate_exception(i32 4)
123 %3 = bitcast i8* %exception to i32*
124 store i32 0, i32* %3, align 16
125 invoke void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null)
126 to label %unreachable unwind label %lpad1
128 lpad: ; preds = %init
129 %4 = landingpad { i8*, i32 }
131 %5 = extractvalue { i8*, i32 } %4, 0
132 %6 = extractvalue { i8*, i32 } %4, 1
133 tail call void @__cxa_guard_abort(i64* nonnull @_ZGVZ2amiE2au) #1
136 lpad1: ; preds = %init.end
137 %7 = landingpad { i8*, i32 }
139 %8 = extractvalue { i8*, i32 } %7, 0
140 %9 = extractvalue { i8*, i32 } %7, 1
141 tail call void @_ZdlPv(i8* nonnull %call.i)
144 eh.resume: ; preds = %lpad1, %lpad
145 %exn.slot.0 = phi i8* [ %8, %lpad1 ], [ %5, %lpad ]
146 %ehselector.slot.0 = phi i32 [ %9, %lpad1 ], [ %6, %lpad ]
147 %lpad.val = insertvalue { i8*, i32 } undef, i8* %exn.slot.0, 0
148 %lpad.val2 = insertvalue { i8*, i32 } %lpad.val, i32 %ehselector.slot.0, 1
149 resume { i8*, i32 } %lpad.val2
151 unreachable: ; preds = %init.end
155 declare i32 @__cxa_guard_acquire(i64*)
156 declare i32 @__gxx_personality_v0(...)
157 declare void @__cxa_guard_abort(i64*)
158 declare void @__cxa_guard_release(i64*)
159 declare i8* @__cxa_allocate_exception(i32)
160 declare void @__cxa_throw(i8*, i8*, i8*)
161 declare noalias nonnull i8* @_Znwj(i32)
162 declare i8* @__cxa_begin_catch(i8*)
163 declare void @__cxa_end_catch()
164 declare void @_ZdlPv(i8*)