1 ; RUN: opt -objc-arc -S < %s | FileCheck %s 2 3 %struct.__objcFastEnumerationState = type { i64, i8**, i64*, [5 x i64] } 4 5 @"\01L_OBJC_METH_VAR_NAME_" = internal global [43 x i8] c"countByEnumeratingWithState:objects:count:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 6 @"\01L_OBJC_SELECTOR_REFERENCES_" = internal global i8* getelementptr inbounds ([43 x i8]* @"\01L_OBJC_METH_VAR_NAME_", i64 0, i64 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" 7 @g = common global i8* null, align 8 8 @"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__DATA, __objc_imageinfo, regular, no_dead_strip" 9 10 declare void @callee() 11 declare i8* @returner() 12 declare i8* @objc_retainAutoreleasedReturnValue(i8*) 13 declare i8* @objc_retain(i8*) 14 declare void @objc_enumerationMutation(i8*) 15 declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind 16 declare i8* @objc_msgSend(i8*, i8*, ...) nonlazybind 17 declare void @use(i8*) 18 declare void @objc_release(i8*) 19 declare i8* @def() 20 declare void @__crasher_block_invoke(i8* nocapture) 21 declare i8* @objc_retainBlock(i8*) 22 declare void @__crasher_block_invoke1(i8* nocapture) 23 24 !0 = metadata !{} 25 26 ; Delete a nested retain+release pair. 27 28 ; CHECK-LABEL: define void @test0( 29 ; CHECK: call i8* @objc_retain 30 ; CHECK-NOT: @objc_retain 31 ; CHECK: } 32 define void @test0(i8* %a) nounwind { 33 entry: 34 %state.ptr = alloca %struct.__objcFastEnumerationState, align 8 35 %items.ptr = alloca [16 x i8*], align 8 36 %0 = call i8* @objc_retain(i8* %a) nounwind 37 %tmp = bitcast %struct.__objcFastEnumerationState* %state.ptr to i8* 38 call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 64, i32 8, i1 false) 39 %1 = call i8* @objc_retain(i8* %0) nounwind 40 %tmp2 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 41 %call = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %1, i8* %tmp2, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 42 %iszero = icmp eq i64 %call, 0 43 br i1 %iszero, label %forcoll.empty, label %forcoll.loopinit 44 45 forcoll.loopinit: 46 %mutationsptr.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 2 47 %mutationsptr = load i64** %mutationsptr.ptr, align 8 48 %forcoll.initial-mutations = load i64* %mutationsptr, align 8 49 %stateitems.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 1 50 br label %forcoll.loopbody.outer 51 52 forcoll.loopbody.outer: 53 %forcoll.count.ph = phi i64 [ %call, %forcoll.loopinit ], [ %call6, %forcoll.refetch ] 54 %tmp7 = icmp ugt i64 %forcoll.count.ph, 1 55 %umax = select i1 %tmp7, i64 %forcoll.count.ph, i64 1 56 br label %forcoll.loopbody 57 58 forcoll.loopbody: 59 %forcoll.index = phi i64 [ 0, %forcoll.loopbody.outer ], [ %4, %forcoll.notmutated ] 60 %mutationsptr3 = load i64** %mutationsptr.ptr, align 8 61 %statemutations = load i64* %mutationsptr3, align 8 62 %2 = icmp eq i64 %statemutations, %forcoll.initial-mutations 63 br i1 %2, label %forcoll.notmutated, label %forcoll.mutated 64 65 forcoll.mutated: 66 call void @objc_enumerationMutation(i8* %1) 67 br label %forcoll.notmutated 68 69 forcoll.notmutated: 70 %stateitems = load i8*** %stateitems.ptr, align 8 71 %currentitem.ptr = getelementptr i8** %stateitems, i64 %forcoll.index 72 %3 = load i8** %currentitem.ptr, align 8 73 call void @use(i8* %3) 74 %4 = add i64 %forcoll.index, 1 75 %exitcond = icmp eq i64 %4, %umax 76 br i1 %exitcond, label %forcoll.refetch, label %forcoll.loopbody 77 78 forcoll.refetch: 79 %tmp5 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 80 %call6 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %1, i8* %tmp5, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 81 %5 = icmp eq i64 %call6, 0 82 br i1 %5, label %forcoll.empty, label %forcoll.loopbody.outer 83 84 forcoll.empty: 85 call void @objc_release(i8* %1) nounwind 86 call void @objc_release(i8* %0) nounwind, !clang.imprecise_release !0 87 ret void 88 } 89 90 ; Delete a nested retain+release pair. 91 92 ; CHECK-LABEL: define void @test2( 93 ; CHECK: call i8* @objc_retain 94 ; CHECK-NOT: @objc_retain 95 ; CHECK: } 96 define void @test2() nounwind { 97 entry: 98 %state.ptr = alloca %struct.__objcFastEnumerationState, align 8 99 %items.ptr = alloca [16 x i8*], align 8 100 %call = call i8* @returner() 101 %0 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call) nounwind 102 %tmp = bitcast %struct.__objcFastEnumerationState* %state.ptr to i8* 103 call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 64, i32 8, i1 false) 104 %1 = call i8* @objc_retain(i8* %0) nounwind 105 %tmp2 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 106 %call3 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %1, i8* %tmp2, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 107 %iszero = icmp eq i64 %call3, 0 108 br i1 %iszero, label %forcoll.empty, label %forcoll.loopinit 109 110 forcoll.loopinit: 111 %mutationsptr.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 2 112 %mutationsptr = load i64** %mutationsptr.ptr, align 8 113 %forcoll.initial-mutations = load i64* %mutationsptr, align 8 114 %stateitems.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 1 115 br label %forcoll.loopbody.outer 116 117 forcoll.loopbody.outer: 118 %forcoll.count.ph = phi i64 [ %call3, %forcoll.loopinit ], [ %call7, %forcoll.refetch ] 119 %tmp8 = icmp ugt i64 %forcoll.count.ph, 1 120 %umax = select i1 %tmp8, i64 %forcoll.count.ph, i64 1 121 br label %forcoll.loopbody 122 123 forcoll.loopbody: 124 %forcoll.index = phi i64 [ 0, %forcoll.loopbody.outer ], [ %4, %forcoll.notmutated ] 125 %mutationsptr4 = load i64** %mutationsptr.ptr, align 8 126 %statemutations = load i64* %mutationsptr4, align 8 127 %2 = icmp eq i64 %statemutations, %forcoll.initial-mutations 128 br i1 %2, label %forcoll.notmutated, label %forcoll.mutated 129 130 forcoll.mutated: 131 call void @objc_enumerationMutation(i8* %1) 132 br label %forcoll.notmutated 133 134 forcoll.notmutated: 135 %stateitems = load i8*** %stateitems.ptr, align 8 136 %currentitem.ptr = getelementptr i8** %stateitems, i64 %forcoll.index 137 %3 = load i8** %currentitem.ptr, align 8 138 call void @use(i8* %3) 139 %4 = add i64 %forcoll.index, 1 140 %exitcond = icmp eq i64 %4, %umax 141 br i1 %exitcond, label %forcoll.refetch, label %forcoll.loopbody 142 143 forcoll.refetch: 144 %tmp6 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 145 %call7 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %1, i8* %tmp6, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 146 %5 = icmp eq i64 %call7, 0 147 br i1 %5, label %forcoll.empty, label %forcoll.loopbody.outer 148 149 forcoll.empty: 150 call void @objc_release(i8* %1) nounwind 151 call void @objc_release(i8* %0) nounwind, !clang.imprecise_release !0 152 ret void 153 } 154 155 ; Delete a nested retain+release pair. 156 157 ; CHECK-LABEL: define void @test4( 158 ; CHECK: call i8* @objc_retain 159 ; CHECK-NOT: @objc_retain 160 ; CHECK: } 161 define void @test4() nounwind { 162 entry: 163 %state.ptr = alloca %struct.__objcFastEnumerationState, align 8 164 %items.ptr = alloca [16 x i8*], align 8 165 %tmp = load i8** @g, align 8 166 %0 = call i8* @objc_retain(i8* %tmp) nounwind 167 %tmp2 = bitcast %struct.__objcFastEnumerationState* %state.ptr to i8* 168 call void @llvm.memset.p0i8.i64(i8* %tmp2, i8 0, i64 64, i32 8, i1 false) 169 %1 = call i8* @objc_retain(i8* %0) nounwind 170 %tmp4 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 171 %call = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %1, i8* %tmp4, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 172 %iszero = icmp eq i64 %call, 0 173 br i1 %iszero, label %forcoll.empty, label %forcoll.loopinit 174 175 forcoll.loopinit: 176 %mutationsptr.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 2 177 %mutationsptr = load i64** %mutationsptr.ptr, align 8 178 %forcoll.initial-mutations = load i64* %mutationsptr, align 8 179 %stateitems.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 1 180 br label %forcoll.loopbody.outer 181 182 forcoll.loopbody.outer: 183 %forcoll.count.ph = phi i64 [ %call, %forcoll.loopinit ], [ %call8, %forcoll.refetch ] 184 %tmp9 = icmp ugt i64 %forcoll.count.ph, 1 185 %umax = select i1 %tmp9, i64 %forcoll.count.ph, i64 1 186 br label %forcoll.loopbody 187 188 forcoll.loopbody: 189 %forcoll.index = phi i64 [ 0, %forcoll.loopbody.outer ], [ %4, %forcoll.notmutated ] 190 %mutationsptr5 = load i64** %mutationsptr.ptr, align 8 191 %statemutations = load i64* %mutationsptr5, align 8 192 %2 = icmp eq i64 %statemutations, %forcoll.initial-mutations 193 br i1 %2, label %forcoll.notmutated, label %forcoll.mutated 194 195 forcoll.mutated: 196 call void @objc_enumerationMutation(i8* %1) 197 br label %forcoll.notmutated 198 199 forcoll.notmutated: 200 %stateitems = load i8*** %stateitems.ptr, align 8 201 %currentitem.ptr = getelementptr i8** %stateitems, i64 %forcoll.index 202 %3 = load i8** %currentitem.ptr, align 8 203 call void @use(i8* %3) 204 %4 = add i64 %forcoll.index, 1 205 %exitcond = icmp eq i64 %4, %umax 206 br i1 %exitcond, label %forcoll.refetch, label %forcoll.loopbody 207 208 forcoll.refetch: 209 %tmp7 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 210 %call8 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %1, i8* %tmp7, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 211 %5 = icmp eq i64 %call8, 0 212 br i1 %5, label %forcoll.empty, label %forcoll.loopbody.outer 213 214 forcoll.empty: 215 call void @objc_release(i8* %1) nounwind 216 call void @objc_release(i8* %0) nounwind, !clang.imprecise_release !0 217 ret void 218 } 219 220 ; Delete a nested retain+release pair. 221 222 ; CHECK-LABEL: define void @test5( 223 ; CHECK: call i8* @objc_retain 224 ; CHECK-NOT: @objc_retain 225 ; CHECK: } 226 define void @test5() nounwind { 227 entry: 228 %state.ptr = alloca %struct.__objcFastEnumerationState, align 8 229 %items.ptr = alloca [16 x i8*], align 8 230 %call = call i8* @returner() 231 %0 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call) nounwind 232 call void @callee() 233 %tmp = bitcast %struct.__objcFastEnumerationState* %state.ptr to i8* 234 call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 64, i32 8, i1 false) 235 %1 = call i8* @objc_retain(i8* %0) nounwind 236 %tmp2 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 237 %call3 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %1, i8* %tmp2, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 238 %iszero = icmp eq i64 %call3, 0 239 br i1 %iszero, label %forcoll.empty, label %forcoll.loopinit 240 241 forcoll.loopinit: 242 %mutationsptr.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 2 243 %mutationsptr = load i64** %mutationsptr.ptr, align 8 244 %forcoll.initial-mutations = load i64* %mutationsptr, align 8 245 %stateitems.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 1 246 br label %forcoll.loopbody.outer 247 248 forcoll.loopbody.outer: 249 %forcoll.count.ph = phi i64 [ %call3, %forcoll.loopinit ], [ %call7, %forcoll.refetch ] 250 %tmp8 = icmp ugt i64 %forcoll.count.ph, 1 251 %umax = select i1 %tmp8, i64 %forcoll.count.ph, i64 1 252 br label %forcoll.loopbody 253 254 forcoll.loopbody: 255 %forcoll.index = phi i64 [ 0, %forcoll.loopbody.outer ], [ %4, %forcoll.notmutated ] 256 %mutationsptr4 = load i64** %mutationsptr.ptr, align 8 257 %statemutations = load i64* %mutationsptr4, align 8 258 %2 = icmp eq i64 %statemutations, %forcoll.initial-mutations 259 br i1 %2, label %forcoll.notmutated, label %forcoll.mutated 260 261 forcoll.mutated: 262 call void @objc_enumerationMutation(i8* %1) 263 br label %forcoll.notmutated 264 265 forcoll.notmutated: 266 %stateitems = load i8*** %stateitems.ptr, align 8 267 %currentitem.ptr = getelementptr i8** %stateitems, i64 %forcoll.index 268 %3 = load i8** %currentitem.ptr, align 8 269 call void @use(i8* %3) 270 %4 = add i64 %forcoll.index, 1 271 %exitcond = icmp eq i64 %4, %umax 272 br i1 %exitcond, label %forcoll.refetch, label %forcoll.loopbody 273 274 forcoll.refetch: 275 %tmp6 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 276 %call7 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %1, i8* %tmp6, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 277 %5 = icmp eq i64 %call7, 0 278 br i1 %5, label %forcoll.empty, label %forcoll.loopbody.outer 279 280 forcoll.empty: 281 call void @objc_release(i8* %1) nounwind 282 call void @objc_release(i8* %0) nounwind, !clang.imprecise_release !0 283 ret void 284 } 285 286 ; TODO: Delete a nested retain+release pair. 287 ; The optimizer currently can't do this, because isn't isn't sophisticated enough in 288 ; reasnoning about nesting. 289 290 ; CHECK-LABEL: define void @test6( 291 ; CHECK: call i8* @objc_retain 292 ; CHECK: @objc_retain 293 ; CHECK: } 294 define void @test6() nounwind { 295 entry: 296 %state.ptr = alloca %struct.__objcFastEnumerationState, align 8 297 %items.ptr = alloca [16 x i8*], align 8 298 %call = call i8* @returner() 299 %0 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call) nounwind 300 %tmp = bitcast %struct.__objcFastEnumerationState* %state.ptr to i8* 301 call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 64, i32 8, i1 false) 302 %1 = call i8* @objc_retain(i8* %0) nounwind 303 %tmp2 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 304 %call3 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %1, i8* %tmp2, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 305 %iszero = icmp eq i64 %call3, 0 306 br i1 %iszero, label %forcoll.empty, label %forcoll.loopinit 307 308 forcoll.loopinit: 309 %mutationsptr.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 2 310 %mutationsptr = load i64** %mutationsptr.ptr, align 8 311 %forcoll.initial-mutations = load i64* %mutationsptr, align 8 312 %stateitems.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 1 313 br label %forcoll.loopbody.outer 314 315 forcoll.loopbody.outer: 316 %forcoll.count.ph = phi i64 [ %call3, %forcoll.loopinit ], [ %call7, %forcoll.refetch ] 317 %tmp8 = icmp ugt i64 %forcoll.count.ph, 1 318 %umax = select i1 %tmp8, i64 %forcoll.count.ph, i64 1 319 br label %forcoll.loopbody 320 321 forcoll.loopbody: 322 %forcoll.index = phi i64 [ 0, %forcoll.loopbody.outer ], [ %4, %forcoll.notmutated ] 323 %mutationsptr4 = load i64** %mutationsptr.ptr, align 8 324 %statemutations = load i64* %mutationsptr4, align 8 325 %2 = icmp eq i64 %statemutations, %forcoll.initial-mutations 326 br i1 %2, label %forcoll.notmutated, label %forcoll.mutated 327 328 forcoll.mutated: 329 call void @objc_enumerationMutation(i8* %1) 330 br label %forcoll.notmutated 331 332 forcoll.notmutated: 333 %stateitems = load i8*** %stateitems.ptr, align 8 334 %currentitem.ptr = getelementptr i8** %stateitems, i64 %forcoll.index 335 %3 = load i8** %currentitem.ptr, align 8 336 call void @use(i8* %3) 337 %4 = add i64 %forcoll.index, 1 338 %exitcond = icmp eq i64 %4, %umax 339 br i1 %exitcond, label %forcoll.refetch, label %forcoll.loopbody 340 341 forcoll.refetch: 342 %tmp6 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 343 %call7 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %1, i8* %tmp6, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 344 %5 = icmp eq i64 %call7, 0 345 br i1 %5, label %forcoll.empty, label %forcoll.loopbody.outer 346 347 forcoll.empty: 348 call void @objc_release(i8* %1) nounwind 349 call void @callee() 350 call void @objc_release(i8* %0) nounwind, !clang.imprecise_release !0 351 ret void 352 } 353 354 ; TODO: Delete a nested retain+release pair. 355 ; The optimizer currently can't do this, because isn't isn't sophisticated enough in 356 ; reasnoning about nesting. 357 358 ; CHECK-LABEL: define void @test7( 359 ; CHECK: call i8* @objc_retain 360 ; CHECK: @objc_retain 361 ; CHECK: } 362 define void @test7() nounwind { 363 entry: 364 %state.ptr = alloca %struct.__objcFastEnumerationState, align 8 365 %items.ptr = alloca [16 x i8*], align 8 366 %call = call i8* @returner() 367 %0 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call) nounwind 368 call void @callee() 369 %tmp = bitcast %struct.__objcFastEnumerationState* %state.ptr to i8* 370 call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 64, i32 8, i1 false) 371 %1 = call i8* @objc_retain(i8* %0) nounwind 372 %tmp2 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 373 %call3 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %1, i8* %tmp2, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 374 %iszero = icmp eq i64 %call3, 0 375 br i1 %iszero, label %forcoll.empty, label %forcoll.loopinit 376 377 forcoll.loopinit: 378 %mutationsptr.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 2 379 %mutationsptr = load i64** %mutationsptr.ptr, align 8 380 %forcoll.initial-mutations = load i64* %mutationsptr, align 8 381 %stateitems.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 1 382 br label %forcoll.loopbody.outer 383 384 forcoll.loopbody.outer: 385 %forcoll.count.ph = phi i64 [ %call3, %forcoll.loopinit ], [ %call7, %forcoll.refetch ] 386 %tmp8 = icmp ugt i64 %forcoll.count.ph, 1 387 %umax = select i1 %tmp8, i64 %forcoll.count.ph, i64 1 388 br label %forcoll.loopbody 389 390 forcoll.loopbody: 391 %forcoll.index = phi i64 [ 0, %forcoll.loopbody.outer ], [ %4, %forcoll.notmutated ] 392 %mutationsptr4 = load i64** %mutationsptr.ptr, align 8 393 %statemutations = load i64* %mutationsptr4, align 8 394 %2 = icmp eq i64 %statemutations, %forcoll.initial-mutations 395 br i1 %2, label %forcoll.notmutated, label %forcoll.mutated 396 397 forcoll.mutated: 398 call void @objc_enumerationMutation(i8* %1) 399 br label %forcoll.notmutated 400 401 forcoll.notmutated: 402 %stateitems = load i8*** %stateitems.ptr, align 8 403 %currentitem.ptr = getelementptr i8** %stateitems, i64 %forcoll.index 404 %3 = load i8** %currentitem.ptr, align 8 405 call void @use(i8* %3) 406 %4 = add i64 %forcoll.index, 1 407 %exitcond = icmp eq i64 %4, %umax 408 br i1 %exitcond, label %forcoll.refetch, label %forcoll.loopbody 409 410 forcoll.refetch: 411 %tmp6 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 412 %call7 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %1, i8* %tmp6, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 413 %5 = icmp eq i64 %call7, 0 414 br i1 %5, label %forcoll.empty, label %forcoll.loopbody.outer 415 416 forcoll.empty: 417 call void @objc_release(i8* %1) nounwind 418 call void @callee() 419 call void @objc_release(i8* %0) nounwind, !clang.imprecise_release !0 420 ret void 421 } 422 423 ; Delete a nested retain+release pair. 424 425 ; CHECK-LABEL: define void @test8( 426 ; CHECK: call i8* @objc_retain 427 ; CHECK-NOT: @objc_retain 428 ; CHECK: } 429 define void @test8() nounwind { 430 entry: 431 %state.ptr = alloca %struct.__objcFastEnumerationState, align 8 432 %items.ptr = alloca [16 x i8*], align 8 433 %call = call i8* @returner() 434 %0 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call) nounwind 435 %tmp = bitcast %struct.__objcFastEnumerationState* %state.ptr to i8* 436 call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 64, i32 8, i1 false) 437 %1 = call i8* @objc_retain(i8* %0) nounwind 438 %tmp2 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 439 %call3 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %1, i8* %tmp2, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 440 %iszero = icmp eq i64 %call3, 0 441 br i1 %iszero, label %forcoll.empty, label %forcoll.loopinit 442 443 forcoll.loopinit: 444 %mutationsptr.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 2 445 %mutationsptr = load i64** %mutationsptr.ptr, align 8 446 %forcoll.initial-mutations = load i64* %mutationsptr, align 8 447 %stateitems.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 1 448 br label %forcoll.loopbody.outer 449 450 forcoll.loopbody.outer: 451 %forcoll.count.ph = phi i64 [ %call3, %forcoll.loopinit ], [ %call7, %forcoll.refetch ] 452 %tmp8 = icmp ugt i64 %forcoll.count.ph, 1 453 %umax = select i1 %tmp8, i64 %forcoll.count.ph, i64 1 454 br label %forcoll.loopbody 455 456 forcoll.loopbody: 457 %forcoll.index = phi i64 [ 0, %forcoll.loopbody.outer ], [ %4, %forcoll.next ] 458 %mutationsptr4 = load i64** %mutationsptr.ptr, align 8 459 %statemutations = load i64* %mutationsptr4, align 8 460 %2 = icmp eq i64 %statemutations, %forcoll.initial-mutations 461 br i1 %2, label %forcoll.notmutated, label %forcoll.mutated 462 463 forcoll.mutated: 464 call void @objc_enumerationMutation(i8* %1) 465 br label %forcoll.notmutated 466 467 forcoll.notmutated: 468 %stateitems = load i8*** %stateitems.ptr, align 8 469 %currentitem.ptr = getelementptr i8** %stateitems, i64 %forcoll.index 470 %3 = load i8** %currentitem.ptr, align 8 471 %tobool = icmp eq i8* %3, null 472 br i1 %tobool, label %forcoll.next, label %if.then 473 474 if.then: 475 call void @callee() 476 br label %forcoll.next 477 478 forcoll.next: 479 %4 = add i64 %forcoll.index, 1 480 %exitcond = icmp eq i64 %4, %umax 481 br i1 %exitcond, label %forcoll.refetch, label %forcoll.loopbody 482 483 forcoll.refetch: 484 %tmp6 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 485 %call7 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %1, i8* %tmp6, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 486 %5 = icmp eq i64 %call7, 0 487 br i1 %5, label %forcoll.empty, label %forcoll.loopbody.outer 488 489 forcoll.empty: 490 call void @objc_release(i8* %1) nounwind 491 call void @objc_release(i8* %0) nounwind, !clang.imprecise_release !0 492 ret void 493 } 494 495 ; TODO: Delete a nested retain+release pair. 496 ; The optimizer currently can't do this, because of a split loop backedge. 497 ; See test9b for the same testcase without a split backedge. 498 499 ; CHECK-LABEL: define void @test9( 500 ; CHECK: call i8* @objc_retain 501 ; CHECK: call i8* @objc_retain 502 ; CHECK: call i8* @objc_retain 503 ; CHECK: } 504 define void @test9() nounwind { 505 entry: 506 %state.ptr = alloca %struct.__objcFastEnumerationState, align 8 507 %items.ptr = alloca [16 x i8*], align 8 508 %call = call i8* @returner() 509 %0 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call) nounwind 510 %call1 = call i8* @returner() 511 %1 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call1) nounwind 512 %tmp = bitcast %struct.__objcFastEnumerationState* %state.ptr to i8* 513 call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 64, i32 8, i1 false) 514 %2 = call i8* @objc_retain(i8* %0) nounwind 515 %tmp3 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 516 %call4 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %2, i8* %tmp3, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 517 %iszero = icmp eq i64 %call4, 0 518 br i1 %iszero, label %forcoll.empty, label %forcoll.loopinit 519 520 forcoll.loopinit: 521 %mutationsptr.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 2 522 %mutationsptr = load i64** %mutationsptr.ptr, align 8 523 %forcoll.initial-mutations = load i64* %mutationsptr, align 8 524 br label %forcoll.loopbody.outer 525 526 forcoll.loopbody.outer: 527 %forcoll.count.ph = phi i64 [ %call4, %forcoll.loopinit ], [ %call7, %forcoll.refetch ] 528 %tmp9 = icmp ugt i64 %forcoll.count.ph, 1 529 %umax = select i1 %tmp9, i64 %forcoll.count.ph, i64 1 530 br label %forcoll.loopbody 531 532 forcoll.loopbody: 533 %forcoll.index = phi i64 [ %phitmp, %forcoll.notmutated.forcoll.loopbody_crit_edge ], [ 1, %forcoll.loopbody.outer ] 534 %mutationsptr5 = load i64** %mutationsptr.ptr, align 8 535 %statemutations = load i64* %mutationsptr5, align 8 536 %3 = icmp eq i64 %statemutations, %forcoll.initial-mutations 537 br i1 %3, label %forcoll.notmutated, label %forcoll.mutated 538 539 forcoll.mutated: 540 call void @objc_enumerationMutation(i8* %2) 541 br label %forcoll.notmutated 542 543 forcoll.notmutated: 544 %exitcond = icmp eq i64 %forcoll.index, %umax 545 br i1 %exitcond, label %forcoll.refetch, label %forcoll.notmutated.forcoll.loopbody_crit_edge 546 547 forcoll.notmutated.forcoll.loopbody_crit_edge: 548 %phitmp = add i64 %forcoll.index, 1 549 br label %forcoll.loopbody 550 551 forcoll.refetch: 552 %tmp6 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 553 %call7 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %2, i8* %tmp6, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 554 %4 = icmp eq i64 %call7, 0 555 br i1 %4, label %forcoll.empty, label %forcoll.loopbody.outer 556 557 forcoll.empty: 558 call void @objc_release(i8* %2) nounwind 559 call void @objc_release(i8* %1) nounwind, !clang.imprecise_release !0 560 call void @objc_release(i8* %0) nounwind, !clang.imprecise_release !0 561 ret void 562 } 563 564 ; Like test9, but without a split backedge. TODO: optimize this. 565 566 ; CHECK-LABEL: define void @test9b( 567 ; CHECK: call i8* @objc_retain 568 ; CHECK: call i8* @objc_retain 569 ; CHECK: @objc_retain 570 ; CHECK: } 571 define void @test9b() nounwind { 572 entry: 573 %state.ptr = alloca %struct.__objcFastEnumerationState, align 8 574 %items.ptr = alloca [16 x i8*], align 8 575 %call = call i8* @returner() 576 %0 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call) nounwind 577 %call1 = call i8* @returner() 578 %1 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call1) nounwind 579 %tmp = bitcast %struct.__objcFastEnumerationState* %state.ptr to i8* 580 call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 64, i32 8, i1 false) 581 %2 = call i8* @objc_retain(i8* %0) nounwind 582 %tmp3 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 583 %call4 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %2, i8* %tmp3, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 584 %iszero = icmp eq i64 %call4, 0 585 br i1 %iszero, label %forcoll.empty, label %forcoll.loopinit 586 587 forcoll.loopinit: 588 %mutationsptr.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 2 589 %mutationsptr = load i64** %mutationsptr.ptr, align 8 590 %forcoll.initial-mutations = load i64* %mutationsptr, align 8 591 br label %forcoll.loopbody.outer 592 593 forcoll.loopbody.outer: 594 %forcoll.count.ph = phi i64 [ %call4, %forcoll.loopinit ], [ %call7, %forcoll.refetch ] 595 %tmp9 = icmp ugt i64 %forcoll.count.ph, 1 596 %umax = select i1 %tmp9, i64 %forcoll.count.ph, i64 1 597 br label %forcoll.loopbody 598 599 forcoll.loopbody: 600 %forcoll.index = phi i64 [ %phitmp, %forcoll.notmutated ], [ 0, %forcoll.loopbody.outer ] 601 %mutationsptr5 = load i64** %mutationsptr.ptr, align 8 602 %statemutations = load i64* %mutationsptr5, align 8 603 %3 = icmp eq i64 %statemutations, %forcoll.initial-mutations 604 br i1 %3, label %forcoll.notmutated, label %forcoll.mutated 605 606 forcoll.mutated: 607 call void @objc_enumerationMutation(i8* %2) 608 br label %forcoll.notmutated 609 610 forcoll.notmutated: 611 %phitmp = add i64 %forcoll.index, 1 612 %exitcond = icmp eq i64 %phitmp, %umax 613 br i1 %exitcond, label %forcoll.refetch, label %forcoll.loopbody 614 615 forcoll.refetch: 616 %tmp6 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 617 %call7 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %2, i8* %tmp6, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 618 %4 = icmp eq i64 %call7, 0 619 br i1 %4, label %forcoll.empty, label %forcoll.loopbody.outer 620 621 forcoll.empty: 622 call void @objc_release(i8* %2) nounwind 623 call void @objc_release(i8* %1) nounwind, !clang.imprecise_release !0 624 call void @objc_release(i8* %0) nounwind, !clang.imprecise_release !0 625 ret void 626 } 627 628 ; TODO: Delete a nested retain+release pair. 629 ; The optimizer currently can't do this, because of a split loop backedge. 630 ; See test10b for the same testcase without a split backedge. 631 632 ; CHECK-LABEL: define void @test10( 633 ; CHECK: call i8* @objc_retain 634 ; CHECK: call i8* @objc_retain 635 ; CHECK: call i8* @objc_retain 636 ; CHECK: } 637 define void @test10() nounwind { 638 entry: 639 %state.ptr = alloca %struct.__objcFastEnumerationState, align 8 640 %items.ptr = alloca [16 x i8*], align 8 641 %call = call i8* @returner() 642 %0 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call) nounwind 643 %call1 = call i8* @returner() 644 %1 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call1) nounwind 645 call void @callee() 646 %tmp = bitcast %struct.__objcFastEnumerationState* %state.ptr to i8* 647 call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 64, i32 8, i1 false) 648 %2 = call i8* @objc_retain(i8* %0) nounwind 649 %tmp3 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 650 %call4 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %2, i8* %tmp3, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 651 %iszero = icmp eq i64 %call4, 0 652 br i1 %iszero, label %forcoll.empty, label %forcoll.loopinit 653 654 forcoll.loopinit: 655 %mutationsptr.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 2 656 %mutationsptr = load i64** %mutationsptr.ptr, align 8 657 %forcoll.initial-mutations = load i64* %mutationsptr, align 8 658 br label %forcoll.loopbody.outer 659 660 forcoll.loopbody.outer: 661 %forcoll.count.ph = phi i64 [ %call4, %forcoll.loopinit ], [ %call7, %forcoll.refetch ] 662 %tmp9 = icmp ugt i64 %forcoll.count.ph, 1 663 %umax = select i1 %tmp9, i64 %forcoll.count.ph, i64 1 664 br label %forcoll.loopbody 665 666 forcoll.loopbody: 667 %forcoll.index = phi i64 [ %phitmp, %forcoll.notmutated.forcoll.loopbody_crit_edge ], [ 1, %forcoll.loopbody.outer ] 668 %mutationsptr5 = load i64** %mutationsptr.ptr, align 8 669 %statemutations = load i64* %mutationsptr5, align 8 670 %3 = icmp eq i64 %statemutations, %forcoll.initial-mutations 671 br i1 %3, label %forcoll.notmutated, label %forcoll.mutated 672 673 forcoll.mutated: 674 call void @objc_enumerationMutation(i8* %2) 675 br label %forcoll.notmutated 676 677 forcoll.notmutated: 678 %exitcond = icmp eq i64 %forcoll.index, %umax 679 br i1 %exitcond, label %forcoll.refetch, label %forcoll.notmutated.forcoll.loopbody_crit_edge 680 681 forcoll.notmutated.forcoll.loopbody_crit_edge: 682 %phitmp = add i64 %forcoll.index, 1 683 br label %forcoll.loopbody 684 685 forcoll.refetch: 686 %tmp6 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 687 %call7 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %2, i8* %tmp6, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 688 %4 = icmp eq i64 %call7, 0 689 br i1 %4, label %forcoll.empty, label %forcoll.loopbody.outer 690 691 forcoll.empty: 692 call void @objc_release(i8* %2) nounwind 693 call void @objc_release(i8* %1) nounwind, !clang.imprecise_release !0 694 call void @objc_release(i8* %0) nounwind, !clang.imprecise_release !0 695 ret void 696 } 697 698 ; Like test10, but without a split backedge. TODO: optimize this. 699 700 ; CHECK-LABEL: define void @test10b( 701 ; CHECK: call i8* @objc_retain 702 ; CHECK: call i8* @objc_retain 703 ; CHECK: @objc_retain 704 ; CHECK: } 705 define void @test10b() nounwind { 706 entry: 707 %state.ptr = alloca %struct.__objcFastEnumerationState, align 8 708 %items.ptr = alloca [16 x i8*], align 8 709 %call = call i8* @returner() 710 %0 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call) nounwind 711 %call1 = call i8* @returner() 712 %1 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call1) nounwind 713 call void @callee() 714 %tmp = bitcast %struct.__objcFastEnumerationState* %state.ptr to i8* 715 call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 64, i32 8, i1 false) 716 %2 = call i8* @objc_retain(i8* %0) nounwind 717 %tmp3 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 718 %call4 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %2, i8* %tmp3, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 719 %iszero = icmp eq i64 %call4, 0 720 br i1 %iszero, label %forcoll.empty, label %forcoll.loopinit 721 722 forcoll.loopinit: 723 %mutationsptr.ptr = getelementptr inbounds %struct.__objcFastEnumerationState* %state.ptr, i64 0, i32 2 724 %mutationsptr = load i64** %mutationsptr.ptr, align 8 725 %forcoll.initial-mutations = load i64* %mutationsptr, align 8 726 br label %forcoll.loopbody.outer 727 728 forcoll.loopbody.outer: 729 %forcoll.count.ph = phi i64 [ %call4, %forcoll.loopinit ], [ %call7, %forcoll.refetch ] 730 %tmp9 = icmp ugt i64 %forcoll.count.ph, 1 731 %umax = select i1 %tmp9, i64 %forcoll.count.ph, i64 1 732 br label %forcoll.loopbody 733 734 forcoll.loopbody: 735 %forcoll.index = phi i64 [ %phitmp, %forcoll.notmutated ], [ 0, %forcoll.loopbody.outer ] 736 %mutationsptr5 = load i64** %mutationsptr.ptr, align 8 737 %statemutations = load i64* %mutationsptr5, align 8 738 %3 = icmp eq i64 %statemutations, %forcoll.initial-mutations 739 br i1 %3, label %forcoll.notmutated, label %forcoll.mutated 740 741 forcoll.mutated: 742 call void @objc_enumerationMutation(i8* %2) 743 br label %forcoll.notmutated 744 745 forcoll.notmutated: 746 %phitmp = add i64 %forcoll.index, 1 747 %exitcond = icmp eq i64 %phitmp, %umax 748 br i1 %exitcond, label %forcoll.refetch, label %forcoll.loopbody 749 750 forcoll.refetch: 751 %tmp6 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 752 %call7 = call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*, %struct.__objcFastEnumerationState*, [16 x i8*]*, i64)*)(i8* %2, i8* %tmp6, %struct.__objcFastEnumerationState* %state.ptr, [16 x i8*]* %items.ptr, i64 16) 753 %4 = icmp eq i64 %call7, 0 754 br i1 %4, label %forcoll.empty, label %forcoll.loopbody.outer 755 756 forcoll.empty: 757 call void @objc_release(i8* %2) nounwind 758 call void @objc_release(i8* %1) nounwind, !clang.imprecise_release !0 759 call void @objc_release(i8* %0) nounwind, !clang.imprecise_release !0 760 ret void 761 } 762 763 ; Pointers to strong pointers can obscure provenance relationships. Be conservative 764 ; in the face of escaping pointers. rdar://12150909. 765 766 %struct.__block_d = type { i64, i64 } 767 768 @_NSConcreteStackBlock = external global i8* 769 @__block_d_tmp = external hidden constant { i64, i64, i8*, i8*, i8*, i8* } 770 @__block_d_tmp5 = external hidden constant { i64, i64, i8*, i8*, i8*, i8* } 771 772 ; CHECK-LABEL: define void @test11( 773 ; CHECK: tail call i8* @objc_retain(i8* %call) [[NUW:#[0-9]+]] 774 ; CHECK: tail call i8* @objc_retain(i8* %call) [[NUW]] 775 ; CHECK: call void @objc_release(i8* %call) [[NUW]], !clang.imprecise_release !0 776 ; CHECK: } 777 define void @test11() { 778 entry: 779 %block = alloca <{ i8*, i32, i32, i8*, %struct.__block_d*, i8* }>, align 8 780 %block9 = alloca <{ i8*, i32, i32, i8*, %struct.__block_d*, i8* }>, align 8 781 %call = call i8* @def(), !clang.arc.no_objc_arc_exceptions !0 782 %foo = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_d*, i8* }>* %block, i64 0, i32 5 783 %block.isa = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_d*, i8* }>* %block, i64 0, i32 0 784 store i8* bitcast (i8** @_NSConcreteStackBlock to i8*), i8** %block.isa, align 8 785 %block.flags = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_d*, i8* }>* %block, i64 0, i32 1 786 store i32 1107296256, i32* %block.flags, align 8 787 %block.reserved = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_d*, i8* }>* %block, i64 0, i32 2 788 store i32 0, i32* %block.reserved, align 4 789 %block.invoke = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_d*, i8* }>* %block, i64 0, i32 3 790 store i8* bitcast (void (i8*)* @__crasher_block_invoke to i8*), i8** %block.invoke, align 8 791 %block.d = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_d*, i8* }>* %block, i64 0, i32 4 792 store %struct.__block_d* bitcast ({ i64, i64, i8*, i8*, i8*, i8* }* @__block_d_tmp to %struct.__block_d*), %struct.__block_d** %block.d, align 8 793 %foo2 = tail call i8* @objc_retain(i8* %call) nounwind 794 store i8* %foo2, i8** %foo, align 8 795 %foo4 = bitcast <{ i8*, i32, i32, i8*, %struct.__block_d*, i8* }>* %block to i8* 796 %foo5 = call i8* @objc_retainBlock(i8* %foo4) nounwind 797 call void @use(i8* %foo5), !clang.arc.no_objc_arc_exceptions !0 798 call void @objc_release(i8* %foo5) nounwind 799 %strongdestroy = load i8** %foo, align 8 800 call void @objc_release(i8* %strongdestroy) nounwind, !clang.imprecise_release !0 801 %foo10 = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_d*, i8* }>* %block9, i64 0, i32 5 802 %block.isa11 = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_d*, i8* }>* %block9, i64 0, i32 0 803 store i8* bitcast (i8** @_NSConcreteStackBlock to i8*), i8** %block.isa11, align 8 804 %block.flags12 = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_d*, i8* }>* %block9, i64 0, i32 1 805 store i32 1107296256, i32* %block.flags12, align 8 806 %block.reserved13 = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_d*, i8* }>* %block9, i64 0, i32 2 807 store i32 0, i32* %block.reserved13, align 4 808 %block.invoke14 = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_d*, i8* }>* %block9, i64 0, i32 3 809 store i8* bitcast (void (i8*)* @__crasher_block_invoke1 to i8*), i8** %block.invoke14, align 8 810 %block.d15 = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_d*, i8* }>* %block9, i64 0, i32 4 811 store %struct.__block_d* bitcast ({ i64, i64, i8*, i8*, i8*, i8* }* @__block_d_tmp5 to %struct.__block_d*), %struct.__block_d** %block.d15, align 8 812 %foo18 = call i8* @objc_retain(i8* %call) nounwind 813 store i8* %call, i8** %foo10, align 8 814 %foo20 = bitcast <{ i8*, i32, i32, i8*, %struct.__block_d*, i8* }>* %block9 to i8* 815 %foo21 = call i8* @objc_retainBlock(i8* %foo20) nounwind 816 call void @use(i8* %foo21), !clang.arc.no_objc_arc_exceptions !0 817 call void @objc_release(i8* %foo21) nounwind 818 %strongdestroy25 = load i8** %foo10, align 8 819 call void @objc_release(i8* %strongdestroy25) nounwind, !clang.imprecise_release !0 820 call void @objc_release(i8* %call) nounwind, !clang.imprecise_release !0 821 ret void 822 } 823 824 ; CHECK: attributes [[NUW]] = { nounwind } 825 ; CHECK: attributes #1 = { nonlazybind } 826