OSDN Git Service

[ObjC][ARC] Convert the retainRV marker that is passed as a named
[android-x86/external-llvm.git] / test / Transforms / ObjCARC / contract-marker.ll
1 ; RUN: opt -S -objc-arc-contract < %s | FileCheck %s
2
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]+]]
8 ; CHECK: }
9
10 define void @foo() {
11 entry:
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)
16   ret void
17 }
18
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]+]]
24 ; CHECK: }
25
26 define void @foo2() {
27 entry:
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)
32   ret void
33 }
34
35
36 declare i32* @qux()
37 declare i8* @llvm.objc.retainAutoreleasedReturnValue(i8*)
38 declare i8* @llvm.objc.unsafeClaimAutoreleasedReturnValue(i8*)
39 declare void @bar(i8*)
40
41 !llvm.module.flags = !{!0}
42
43 !0 = !{i32 1, !"clang.arc.retainAutoreleasedReturnValueMarker", !"mov\09r7, r7\09\09@ marker for return value optimization"}
44
45 ; CHECK: attributes [[NUW]] = { nounwind }