xref: /llvm-project/llvm/test/Transforms/ObjCARC/pointer-types.ll (revision 01e4f41b43b57dee751146fde9992c660bd7c714)
1; RUN: opt -passes=objc-arc -S < %s | FileCheck %s
2
3; Don't hoist @llvm.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 ptr [ %b1, %if.then ], [ null, %entry ]
10; CHECK-NEXT: call void @use_fptr(ptr %otherBlock)
11; CHECK-NEXT: call void @llvm.objc.release(ptr %otherBlock)
12
13define void @test0(i1 %tobool, ptr %b1) {
14entry:
15  br i1 %tobool, label %if.end, label %if.then
16
17if.then:                                          ; preds = %entry
18  br label %if.end
19
20if.end:                                           ; preds = %if.then, %entry
21  %otherBlock = phi ptr [ %b1, %if.then ], [ null, %entry ]
22  call void @use_fptr(ptr %otherBlock)
23  call void @llvm.objc.release(ptr %otherBlock) nounwind
24  ret void
25}
26
27declare void @use_fptr(ptr)
28declare void @llvm.objc.release(ptr)
29
30