File: contract-marker.ll

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (61 lines) | stat: -rw-r--r-- 1,935 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
; RUN: opt -S -passes=objc-arc-contract < %s | FileCheck %s

; CHECK-LABEL: define void @foo() {
; CHECK:      %call = tail call ptr @qux()
; CHECK-NEXT: call void asm sideeffect "mov\09r7, r7\09\09@ marker for return value optimization", ""()
; CHECK-NEXT: %0 = tail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %call) [[NUW:#[0-9]+]]
; CHECK: }

define void @foo() {
entry:
  %call = tail call ptr @qux()
  %0 = tail call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %call) nounwind
  tail call void @bar(ptr %0)
  ret void
}

; CHECK-LABEL: define void @foo2() {
; CHECK:      %call = tail call ptr @qux()
; CHECK-NEXT: call void asm sideeffect "mov\09r7, r7\09\09@ marker for return value optimization", ""()
; CHECK-NEXT: %0 = tail call ptr @llvm.objc.unsafeClaimAutoreleasedReturnValue(ptr %call) [[NUW:#[0-9]+]]
; CHECK: }

define void @foo2() {
entry:
  %call = tail call ptr @qux()
  %0 = tail call ptr @llvm.objc.unsafeClaimAutoreleasedReturnValue(ptr %call) nounwind
  tail call void @bar(ptr %0)
  ret void
}

; CHECK-LABEL: define ptr @foo3(
; CHECK: call ptr @returnsArg(
; CHECK-NEXT: call void asm sideeffect

define ptr @foo3(ptr %a) {
  %call = call ptr @returnsArg(ptr %a)
  call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %call)
  ret ptr %call
}

; CHECK-LABEL: define ptr @foo4(
; CHECK: call ptr @returnsArg(
; CHECK-NEXT: call void asm sideeffect

define ptr @foo4(ptr %a) {
  %call = call ptr @returnsArg(ptr %a)
  call ptr @llvm.objc.retainAutoreleasedReturnValue(ptr %a)
  ret ptr %call
}

declare ptr @qux()
declare ptr @llvm.objc.retainAutoreleasedReturnValue(ptr)
declare ptr @llvm.objc.unsafeClaimAutoreleasedReturnValue(ptr)
declare void @bar(ptr)
declare ptr @returnsArg(ptr returned)

!llvm.module.flags = !{!0}

!0 = !{i32 1, !"clang.arc.retainAutoreleasedReturnValueMarker", !"mov\09r7, r7\09\09@ marker for return value optimization"}

; CHECK: attributes [[NUW]] = { nounwind }