1 ; RUN: opt -S -objc-arc-contract < %s | FileCheck %s
3 ; CHECK-LABEL: define void @foo() {
4 ; CHECK: %call = tail call i32* @qux()
5 ; CHECK-NEXT: %tcall = bitcast i32* %call to i8*
6 ; CHECK-NEXT: call void asm sideeffect "mov\09r7, r7\09\09@ marker for return value optimization", ""()
7 ; CHECK-NEXT: %0 = tail call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %tcall) [[NUW:#[0-9]+]]
12 %call = tail call i32* @qux()
13 %tcall = bitcast i32* %call to i8*
14 %0 = tail call i8* @llvm.objc.retainAutoreleasedReturnValue(i8* %tcall) nounwind
15 tail call void @bar(i8* %0)
19 ; CHECK-LABEL: define void @foo2() {
20 ; CHECK: %call = tail call i32* @qux()
21 ; CHECK-NEXT: %tcall = bitcast i32* %call to i8*
22 ; CHECK-NEXT: call void asm sideeffect "mov\09r7, r7\09\09@ marker for return value optimization", ""()
23 ; CHECK-NEXT: %0 = tail call i8* @llvm.objc.unsafeClaimAutoreleasedReturnValue(i8* %tcall) [[NUW:#[0-9]+]]
28 %call = tail call i32* @qux()
29 %tcall = bitcast i32* %call to i8*
30 %0 = tail call i8* @llvm.objc.unsafeClaimAutoreleasedReturnValue(i8* %tcall) nounwind
31 tail call void @bar(i8* %0)
37 declare i8* @llvm.objc.retainAutoreleasedReturnValue(i8*)
38 declare i8* @llvm.objc.unsafeClaimAutoreleasedReturnValue(i8*)
39 declare void @bar(i8*)
41 !llvm.module.flags = !{!0}
43 !0 = !{i32 1, !"clang.arc.retainAutoreleasedReturnValueMarker", !"mov\09r7, r7\09\09@ marker for return value optimization"}
45 ; CHECK: attributes [[NUW]] = { nounwind }