1 ; RUN: opt -S -passes=objc-arc < %s | FileCheck %s
3 ; Handle a retain+release pair entirely contained within a split loop backedge.
6 ; CHECK-LABEL: define void @test0(
7 ; CHECK: call ptr @llvm.objc.retain(ptr %call) [[NUW:#[0-9]+]]
8 ; CHECK: call ptr @llvm.objc.retain(ptr %call) [[NUW]]
9 ; CHECK: call ptr @llvm.objc.retain(ptr %cond) [[NUW]]
10 ; CHECK: call void @llvm.objc.release(ptr %call) [[NUW]]
11 ; CHECK: call void @llvm.objc.release(ptr %call) [[NUW]]
12 ; CHECK: call void @llvm.objc.release(ptr %cond) [[NUW]]
13 define void @test0() personality ptr @__objc_personality_v0 {
17 while.body: ; preds = %while.cond
18 %call = invoke ptr @returner()
19 to label %invoke.cont unwind label %lpad, !clang.arc.no_objc_arc_exceptions !0
21 invoke.cont: ; preds = %while.body
22 %t0 = call ptr @llvm.objc.retain(ptr %call) nounwind
23 %t1 = call ptr @llvm.objc.retain(ptr %call) nounwind
24 %call.i1 = invoke ptr @returner()
25 to label %invoke.cont1 unwind label %lpad
27 invoke.cont1: ; preds = %invoke.cont
28 %cond = select i1 undef, ptr null, ptr %call
29 %t2 = call ptr @llvm.objc.retain(ptr %cond) nounwind
30 call void @llvm.objc.release(ptr %call) nounwind
31 call void @llvm.objc.release(ptr %call) nounwind
32 call void @use_pointer(ptr %cond)
33 call void @llvm.objc.release(ptr %cond) nounwind
36 lpad: ; preds = %invoke.cont, %while.body
37 %t4 = landingpad { ptr, i32 }
42 declare ptr @returner()
43 declare i32 @__objc_personality_v0(...)
44 declare void @llvm.objc.release(ptr)
45 declare ptr @llvm.objc.retain(ptr)
46 declare void @use_pointer(ptr)
50 ; CHECK: attributes [[NUW]] = { nounwind }