1 ; RUN: opt -objc-arc -S < %s | FileCheck %s
3 ; Generated by compiling:
5 ; id baz(void *X) { return (__bridge_transfer id)X; }
10 ; Y = (__bridge_retained void *)X;
14 ; clang -x objective-c -mllvm -enable-objc-arc-opts=0 -fobjc-arc -S -emit-llvm test.m
16 ; And then hand-reduced further.
18 declare i8* @llvm.objc.autoreleaseReturnValue(i8*)
19 declare i8* @llvm.objc.unsafeClaimAutoreleasedReturnValue(i8*)
20 declare i8* @llvm.objc.retain(i8*)
21 declare void @llvm.objc.release(i8*)
23 define void @foo(i8* %X) {
25 %0 = tail call i8* @llvm.objc.retain(i8* %X)
26 %tobool = icmp eq i8* %0, null
27 br i1 %tobool, label %if.end, label %if.then
29 if.then: ; preds = %entry
30 %1 = tail call i8* @llvm.objc.retain(i8* nonnull %0)
33 if.end: ; preds = %if.then, %entry
34 %Y.0 = phi i8* [ %1, %if.then ], [ null, %entry ]
35 %2 = tail call i8* @llvm.objc.autoreleaseReturnValue(i8* %Y.0)
36 %3 = tail call i8* @llvm.objc.unsafeClaimAutoreleasedReturnValue(i8* %2)
37 tail call void @llvm.objc.release(i8* %0)
42 ; CHECK: tail call i8* @llvm.objc.retain
43 ; CHECK-NEXT: call i8* @llvm.objc.autorelease
45 ; CHECK-NEXT: tail call i8* @llvm.objc.unsafeClaimAutoreleasedReturnValue(i8* %Y.0)
46 ; CHECK-NEXT: tail call void @llvm.objc.release