1*9880d681SAndroid Build Coastguard Worker; RUN: opt -S -objc-arc < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; Handle a retain+release pair entirely contained within a split loop backedge. 4*9880d681SAndroid Build Coastguard Worker; rdar://11256239 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: define void @test0( 7*9880d681SAndroid Build Coastguard Worker; CHECK: call i8* @objc_retain(i8* %call) [[NUW:#[0-9]+]] 8*9880d681SAndroid Build Coastguard Worker; CHECK: call i8* @objc_retain(i8* %call) [[NUW]] 9*9880d681SAndroid Build Coastguard Worker; CHECK: call i8* @objc_retain(i8* %cond) [[NUW]] 10*9880d681SAndroid Build Coastguard Worker; CHECK: call void @objc_release(i8* %call) [[NUW]] 11*9880d681SAndroid Build Coastguard Worker; CHECK: call void @objc_release(i8* %call) [[NUW]] 12*9880d681SAndroid Build Coastguard Worker; CHECK: call void @objc_release(i8* %cond) [[NUW]] 13*9880d681SAndroid Build Coastguard Workerdefine void @test0() personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) { 14*9880d681SAndroid Build Coastguard Workerentry: 15*9880d681SAndroid Build Coastguard Worker br label %while.body 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Workerwhile.body: ; preds = %while.cond 18*9880d681SAndroid Build Coastguard Worker %call = invoke i8* @returner() 19*9880d681SAndroid Build Coastguard Worker to label %invoke.cont unwind label %lpad, !clang.arc.no_objc_arc_exceptions !0 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Workerinvoke.cont: ; preds = %while.body 22*9880d681SAndroid Build Coastguard Worker %t0 = call i8* @objc_retain(i8* %call) nounwind 23*9880d681SAndroid Build Coastguard Worker %t1 = call i8* @objc_retain(i8* %call) nounwind 24*9880d681SAndroid Build Coastguard Worker %call.i1 = invoke i8* @returner() 25*9880d681SAndroid Build Coastguard Worker to label %invoke.cont1 unwind label %lpad 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Workerinvoke.cont1: ; preds = %invoke.cont 28*9880d681SAndroid Build Coastguard Worker %cond = select i1 undef, i8* null, i8* %call 29*9880d681SAndroid Build Coastguard Worker %t2 = call i8* @objc_retain(i8* %cond) nounwind 30*9880d681SAndroid Build Coastguard Worker call void @objc_release(i8* %call) nounwind 31*9880d681SAndroid Build Coastguard Worker call void @objc_release(i8* %call) nounwind 32*9880d681SAndroid Build Coastguard Worker call void @use_pointer(i8* %cond) 33*9880d681SAndroid Build Coastguard Worker call void @objc_release(i8* %cond) nounwind 34*9880d681SAndroid Build Coastguard Worker br label %while.body 35*9880d681SAndroid Build Coastguard Worker 36*9880d681SAndroid Build Coastguard Workerlpad: ; preds = %invoke.cont, %while.body 37*9880d681SAndroid Build Coastguard Worker %t4 = landingpad { i8*, i32 } 38*9880d681SAndroid Build Coastguard Worker catch i8* null 39*9880d681SAndroid Build Coastguard Worker ret void 40*9880d681SAndroid Build Coastguard Worker} 41*9880d681SAndroid Build Coastguard Worker 42*9880d681SAndroid Build Coastguard Workerdeclare i8* @returner() 43*9880d681SAndroid Build Coastguard Workerdeclare i32 @__objc_personality_v0(...) 44*9880d681SAndroid Build Coastguard Workerdeclare void @objc_release(i8*) 45*9880d681SAndroid Build Coastguard Workerdeclare i8* @objc_retain(i8*) 46*9880d681SAndroid Build Coastguard Workerdeclare void @use_pointer(i8*) 47*9880d681SAndroid Build Coastguard Worker 48*9880d681SAndroid Build Coastguard Worker!0 = !{} 49*9880d681SAndroid Build Coastguard Worker 50*9880d681SAndroid Build Coastguard Worker; CHECK: attributes [[NUW]] = { nounwind } 51