1; RUN: opt -objc-arc -S < %s | FileCheck %s 2 3; Generated by compiling: 4; 5; id baz(void *X) { return (__bridge_transfer id)X; } 6; 7; void foo(id X) { 8; void *Y = 0; 9; if (X) 10; Y = (__bridge_retained void *)X; 11; baz(Y); 12; } 13; 14; clang -x objective-c -mllvm -enable-objc-arc-opts=0 -fobjc-arc -S -emit-llvm test.m 15; 16; And then hand-reduced further. 17 18declare i8* @objc_autoreleaseReturnValue(i8*) 19declare i8* @objc_unsafeClaimAutoreleasedReturnValue(i8*) 20declare i8* @objc_retain(i8*) 21declare void @objc_release(i8*) 22 23define void @foo(i8* %X) { 24entry: 25 %0 = tail call i8* @objc_retain(i8* %X) 26 %tobool = icmp eq i8* %0, null 27 br i1 %tobool, label %if.end, label %if.then 28 29if.then: ; preds = %entry 30 %1 = tail call i8* @objc_retain(i8* nonnull %0) 31 br label %if.end 32 33if.end: ; preds = %if.then, %entry 34 %Y.0 = phi i8* [ %1, %if.then ], [ null, %entry ] 35 %2 = tail call i8* @objc_autoreleaseReturnValue(i8* %Y.0) 36 %3 = tail call i8* @objc_unsafeClaimAutoreleasedReturnValue(i8* %2) 37 tail call void @objc_release(i8* %0) 38 ret void 39} 40 41; CHECK: if.then 42; CHECK: tail call i8* @objc_retain 43; CHECK-NEXT: call i8* @objc_autorelease 44; CHECK: %Y.0 = phi 45; CHECK-NEXT: tail call i8* @objc_unsafeClaimAutoreleasedReturnValue(i8* %Y.0) 46; CHECK-NEXT: tail call void @objc_release 47 48