1*9880d681SAndroid Build Coastguard Worker; RUN: opt -S -objc-arc-aa -basicaa -gvn < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker; rdar://10050579 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker; objc_retainBlock stores into %repeater so the load from after the 5*9880d681SAndroid Build Coastguard Worker; call isn't forwardable from the store before the call. 6*9880d681SAndroid Build Coastguard Worker 7*9880d681SAndroid Build Coastguard Worker; CHECK: %tmp16 = call i8* @objc_retainBlock(i8* %tmp15) [[NUW:#[0-9]+]] 8*9880d681SAndroid Build Coastguard Worker; CHECK: %tmp17 = bitcast i8* %tmp16 to void ()* 9*9880d681SAndroid Build Coastguard Worker; CHECK: %tmp18 = load %struct.__block_byref_repeater*, %struct.__block_byref_repeater** %byref.forwarding, align 8 10*9880d681SAndroid Build Coastguard Worker; CHECK: %repeater12 = getelementptr inbounds %struct.__block_byref_repeater, %struct.__block_byref_repeater* %tmp18, i64 0, i32 6 11*9880d681SAndroid Build Coastguard Worker; CHECK: store void ()* %tmp17, void ()** %repeater12, align 8 12*9880d681SAndroid Build Coastguard Worker 13*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" 14*9880d681SAndroid Build Coastguard Worker 15*9880d681SAndroid Build Coastguard Worker%0 = type opaque 16*9880d681SAndroid Build Coastguard Worker%struct.__block_byref_repeater = type { i8*, %struct.__block_byref_repeater*, i32, i32, i8*, i8*, void ()* } 17*9880d681SAndroid Build Coastguard Worker%struct.__block_descriptor = type { i64, i64 } 18*9880d681SAndroid Build Coastguard Worker 19*9880d681SAndroid Build Coastguard Workerdefine void @foo() noreturn { 20*9880d681SAndroid Build Coastguard Workerentry: 21*9880d681SAndroid Build Coastguard Worker %repeater = alloca %struct.__block_byref_repeater, align 8 22*9880d681SAndroid Build Coastguard Worker %block = alloca <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0*, i8* }>, align 8 23*9880d681SAndroid Build Coastguard Worker %byref.forwarding = getelementptr inbounds %struct.__block_byref_repeater, %struct.__block_byref_repeater* %repeater, i64 0, i32 1 24*9880d681SAndroid Build Coastguard Worker %tmp10 = getelementptr inbounds %struct.__block_byref_repeater, %struct.__block_byref_repeater* %repeater, i64 0, i32 6 25*9880d681SAndroid Build Coastguard Worker store void ()* null, void ()** %tmp10, align 8 26*9880d681SAndroid Build Coastguard Worker %block.captured11 = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0*, i8* }>, <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0*, i8* }>* %block, i64 0, i32 6 27*9880d681SAndroid Build Coastguard Worker %tmp14 = bitcast %struct.__block_byref_repeater* %repeater to i8* 28*9880d681SAndroid Build Coastguard Worker store i8* %tmp14, i8** %block.captured11, align 8 29*9880d681SAndroid Build Coastguard Worker %tmp15 = bitcast <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0*, i8* }>* %block to i8* 30*9880d681SAndroid Build Coastguard Worker %tmp16 = call i8* @objc_retainBlock(i8* %tmp15) nounwind 31*9880d681SAndroid Build Coastguard Worker %tmp17 = bitcast i8* %tmp16 to void ()* 32*9880d681SAndroid Build Coastguard Worker %tmp18 = load %struct.__block_byref_repeater*, %struct.__block_byref_repeater** %byref.forwarding, align 8 33*9880d681SAndroid Build Coastguard Worker %repeater12 = getelementptr inbounds %struct.__block_byref_repeater, %struct.__block_byref_repeater* %tmp18, i64 0, i32 6 34*9880d681SAndroid Build Coastguard Worker %tmp13 = load void ()*, void ()** %repeater12, align 8 35*9880d681SAndroid Build Coastguard Worker store void ()* %tmp17, void ()** %repeater12, align 8 36*9880d681SAndroid Build Coastguard Worker ret void 37*9880d681SAndroid Build Coastguard Worker} 38*9880d681SAndroid Build Coastguard Worker 39*9880d681SAndroid Build Coastguard Workerdeclare i8* @objc_retainBlock(i8*) 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Worker; CHECK: attributes #0 = { noreturn } 42*9880d681SAndroid Build Coastguard Worker; CHECK: attributes [[NUW]] = { nounwind } 43