1; RUN: opt -objc-arc -S < %s | FileCheck %s
2
3; Don't hoist @objc_release past a use of its pointer, even
4; if the use has function type, because clang uses function types
5; in dubious ways.
6; rdar://10551239
7
8; CHECK-LABEL: define void @test0(
9; CHECK: %otherBlock = phi void ()* [ %b1, %if.then ], [ null, %entry ]
10; CHECK-NEXT: call void @use_fptr(void ()* %otherBlock)
11; CHECK-NEXT: %tmp11 = bitcast void ()* %otherBlock to i8*
12; CHECK-NEXT: call void @objc_release(i8* %tmp11)
13
14define void @test0(i1 %tobool, void ()* %b1) {
15entry:
16  br i1 %tobool, label %if.end, label %if.then
17
18if.then:                                          ; preds = %entry
19  br label %if.end
20
21if.end:                                           ; preds = %if.then, %entry
22  %otherBlock = phi void ()* [ %b1, %if.then ], [ null, %entry ]
23  call void @use_fptr(void ()* %otherBlock)
24  %tmp11 = bitcast void ()* %otherBlock to i8*
25  call void @objc_release(i8* %tmp11) nounwind
26  ret void
27}
28
29declare void @use_fptr(void ()*)
30declare void @objc_release(i8*)
31
32