SimplifyCFG: don't remove unreachable default switch destinations
[oota-llvm.git] / test / Transforms / ObjCARC / pointer-types.ll
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
14 define void @test0(i1 %tobool, void ()* %b1) {
15 entry:
16   br i1 %tobool, label %if.end, label %if.then
17
18 if.then:                                          ; preds = %entry
19   br label %if.end
20
21 if.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
29 declare void @use_fptr(void ()*)
30 declare void @objc_release(i8*)
31