llvm-6502/test/Transforms/ObjCARC/pointer-types.ll
Dan Gohman f9096e450b It turns out that clang does use pointer-to-function types to
point to ARC-managed pointers sometimes. This fixes rdar://10551239.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146577 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-14 19:10:53 +00:00

32 lines
1.0 KiB
LLVM

; RUN: opt -objc-arc -S < %s | FileCheck %s
; Don't hoist @objc_release past a use of its pointer, even
; if the use has function type, because clang uses function types
; in dubious ways.
; rdar://10551239
; CHECK: define void @test0(
; CHECK: %otherBlock = phi void ()* [ %b1, %if.then ], [ null, %entry ]
; CHECK-NEXT: call void @use_fptr(void ()* %otherBlock)
; CHECK-NEXT: %tmp11 = bitcast void ()* %otherBlock to i8*
; CHECK-NEXT: call void @objc_release(i8* %tmp11)
define void @test0(i1 %tobool, void ()* %b1) {
entry:
br i1 %tobool, label %if.end, label %if.then
if.then: ; preds = %entry
br label %if.end
if.end: ; preds = %if.then, %entry
%otherBlock = phi void ()* [ %b1, %if.then ], [ null, %entry ]
call void @use_fptr(void ()* %otherBlock)
%tmp11 = bitcast void ()* %otherBlock to i8*
call void @objc_release(i8* %tmp11) nounwind
ret void
}
declare void @use_fptr(void ()*)
declare void @objc_release(i8*)