File: arm64-this-return.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (173 lines) | stat: -rw-r--r-- 8,382 bytes parent folder | download | duplicates (7)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
; RUN: llc < %s -mtriple=arm64-eabi | FileCheck %s
; RUN: llc < %s -mtriple=arm64-eabi -global-isel -global-isel-abort=1 | FileCheck %s
; RUN: llc < %s -mtriple=arm64-eabi -global-isel -global-isel-abort=1 -stop-after=irtranslator | FileCheck %s --check-prefix=GISEL-MIR

%struct.A = type { i8 }
%struct.B = type { i32 }
%struct.C = type { %struct.B }
%struct.D = type { %struct.B }
%struct.E = type { %struct.B, %struct.B }

declare %struct.A* @A_ctor_base(%struct.A* returned)
declare %struct.B* @B_ctor_base(%struct.B* returned, i32)
declare %struct.B* @B_ctor_complete(%struct.B* returned, i32)

declare %struct.A* @A_ctor_base_nothisret(%struct.A*)
declare %struct.B* @B_ctor_base_nothisret(%struct.B*, i32)
declare %struct.B* @B_ctor_complete_nothisret(%struct.B*, i32)

define %struct.C* @C_ctor_base(%struct.C* returned %this, i32 %x) {
  ; GISEL-MIR-LABEL: name: C_ctor_base
  ; GISEL-MIR: bb.1.entry:
  ; GISEL-MIR:   liveins: $w1, $x0
  ; GISEL-MIR:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0
  ; GISEL-MIR:   [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
  ; GISEL-MIR:   ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)
  ; GISEL-MIR:   BL @A_ctor_base, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0
  ; GISEL-MIR:   [[COPY2:%[0-9]+]]:_(p0) = COPY [[COPY]](p0)
  ; GISEL-MIR:   ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)
  ; GISEL-MIR:   $w1 = COPY [[COPY1]](s32)
  ; GISEL-MIR:   TCRETURNdi @B_ctor_base, 0, csr_aarch64_aapcs, implicit $sp, implicit $x0, implicit $w1
entry:
; CHECK-LABEL: C_ctor_base:
; CHECK-NOT: mov {{x[0-9]+}}, x0
; CHECK: bl {{_?A_ctor_base}}
; CHECK-NOT: mov x0, {{x[0-9]+}}
; CHECK: b {{_?B_ctor_base}}
  %0 = bitcast %struct.C* %this to %struct.A*
  %call = tail call %struct.A* @A_ctor_base(%struct.A* returned %0)
  %1 = getelementptr inbounds %struct.C, %struct.C* %this, i32 0, i32 0
  %call2 = tail call %struct.B* @B_ctor_base(%struct.B* returned %1, i32 %x)
  ret %struct.C* %this
}

define %struct.C* @C_ctor_base_nothisret(%struct.C* %this, i32 %x) {
  ; GISEL-MIR-LABEL: name: C_ctor_base_nothisret
  ; GISEL-MIR: bb.1.entry:
  ; GISEL-MIR:   liveins: $w1, $x0
  ; GISEL-MIR:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0
  ; GISEL-MIR:   [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
  ; GISEL-MIR:   ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)
  ; GISEL-MIR:   BL @A_ctor_base_nothisret, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit-def $x0
  ; GISEL-MIR:   [[COPY2:%[0-9]+]]:_(p0) = COPY $x0
  ; GISEL-MIR:   ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
  ; GISEL-MIR:   ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)
  ; GISEL-MIR:   $w1 = COPY [[COPY1]](s32)
  ; GISEL-MIR:   BL @B_ctor_base_nothisret, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1, implicit-def $x0
  ; GISEL-MIR:   [[COPY3:%[0-9]+]]:_(p0) = COPY $x0
  ; GISEL-MIR:   ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)
  ; GISEL-MIR:   RET_ReallyLR implicit $x0
entry:
; CHECK-LABEL: C_ctor_base_nothisret:
; CHECK: mov [[SAVETHIS:x[0-9]+]], x0
; CHECK: bl {{_?A_ctor_base_nothisret}}
; CHECK: mov x0, [[SAVETHIS]]
; CHECK-NOT: b {{_?B_ctor_base_nothisret}}
  %0 = bitcast %struct.C* %this to %struct.A*
  %call = tail call %struct.A* @A_ctor_base_nothisret(%struct.A* %0)
  %1 = getelementptr inbounds %struct.C, %struct.C* %this, i32 0, i32 0
  %call2 = tail call %struct.B* @B_ctor_base_nothisret(%struct.B* %1, i32 %x)
  ret %struct.C* %this
}

define %struct.C* @C_ctor_complete(%struct.C* %this, i32 %x) {
  ; GISEL-MIR-LABEL: name: C_ctor_complete
  ; GISEL-MIR: bb.1.entry:
  ; GISEL-MIR:   liveins: $w1, $x0
  ; GISEL-MIR:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0
  ; GISEL-MIR:   [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)
  ; GISEL-MIR:   $w1 = COPY [[COPY1]](s32)
  ; GISEL-MIR:   TCRETURNdi @C_ctor_base, 0, csr_aarch64_aapcs, implicit $sp, implicit $x0, implicit $w1
entry:
; CHECK-LABEL: C_ctor_complete:
; CHECK: b {{_?C_ctor_base}}
  %call = tail call %struct.C* @C_ctor_base(%struct.C* returned %this, i32 %x)
  ret %struct.C* %this
}

define %struct.C* @C_ctor_complete_nothisret(%struct.C* %this, i32 %x) {
  ; GISEL-MIR-LABEL: name: C_ctor_complete_nothisret
  ; GISEL-MIR: bb.1.entry:
  ; GISEL-MIR:   liveins: $w1, $x0
  ; GISEL-MIR:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0
  ; GISEL-MIR:   [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
  ; GISEL-MIR:   ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)
  ; GISEL-MIR:   $w1 = COPY [[COPY1]](s32)
  ; GISEL-MIR:   BL @C_ctor_base_nothisret, csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1, implicit-def $x0
  ; GISEL-MIR:   [[COPY2:%[0-9]+]]:_(p0) = COPY $x0
  ; GISEL-MIR:   ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)
  ; GISEL-MIR:   RET_ReallyLR implicit $x0
entry:
; CHECK-LABEL: C_ctor_complete_nothisret:
; CHECK-NOT: b {{_?C_ctor_base_nothisret}}
  %call = tail call %struct.C* @C_ctor_base_nothisret(%struct.C* %this, i32 %x)
  ret %struct.C* %this
}

define %struct.D* @D_ctor_base(%struct.D* %this, i32 %x) {
  ; GISEL-MIR-LABEL: name: D_ctor_base
  ; GISEL-MIR: bb.1.entry:
  ; GISEL-MIR:   liveins: $w1, $x0
  ; GISEL-MIR:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0
  ; GISEL-MIR:   [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
  ; GISEL-MIR:   ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)
  ; GISEL-MIR:   $w1 = COPY [[COPY1]](s32)
  ; GISEL-MIR:   BL @B_ctor_complete, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1
  ; GISEL-MIR:   [[COPY2:%[0-9]+]]:_(p0) = COPY [[COPY]](p0)
  ; GISEL-MIR:   ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)
  ; GISEL-MIR:   $w1 = COPY [[COPY1]](s32)
  ; GISEL-MIR:   TCRETURNdi @B_ctor_complete, 0, csr_aarch64_aapcs, implicit $sp, implicit $x0, implicit $w1
entry:
; CHECK-LABEL: D_ctor_base:
; CHECK-NOT: mov {{x[0-9]+}}, x0
; CHECK: bl {{_?B_ctor_complete}}
; CHECK-NOT: mov x0, {{x[0-9]+}}
; CHECK: b {{_?B_ctor_complete}}
  %b = getelementptr inbounds %struct.D, %struct.D* %this, i32 0, i32 0
  %call = tail call %struct.B* @B_ctor_complete(%struct.B* returned %b, i32 %x)
  %call2 = tail call %struct.B* @B_ctor_complete(%struct.B* returned %b, i32 %x)
  ret %struct.D* %this
}

define %struct.E* @E_ctor_base(%struct.E* %this, i32 %x) {
  ; GISEL-MIR-LABEL: name: E_ctor_base
  ; GISEL-MIR: bb.1.entry:
  ; GISEL-MIR:   liveins: $w1, $x0
  ; GISEL-MIR:   [[COPY:%[0-9]+]]:_(p0) = COPY $x0
  ; GISEL-MIR:   [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
  ; GISEL-MIR:   ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)
  ; GISEL-MIR:   $w1 = COPY [[COPY1]](s32)
  ; GISEL-MIR:   BL @B_ctor_complete, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1
  ; GISEL-MIR:   [[COPY2:%[0-9]+]]:_(p0) = COPY [[COPY]](p0)
  ; GISEL-MIR:   ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
  ; GISEL-MIR:   [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
  ; GISEL-MIR:   [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s64)
  ; GISEL-MIR:   ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp
  ; GISEL-MIR:   $x0 = COPY [[PTR_ADD]](p0)
  ; GISEL-MIR:   $w1 = COPY [[COPY1]](s32)
  ; GISEL-MIR:   BL @B_ctor_complete, csr_aarch64_aapcs_thisreturn, implicit-def $lr, implicit $sp, implicit $x0, implicit $w1
  ; GISEL-MIR:   [[COPY3:%[0-9]+]]:_(p0) = COPY [[PTR_ADD]](p0)
  ; GISEL-MIR:   ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp
  ; GISEL-MIR:   $x0 = COPY [[COPY]](p0)
  ; GISEL-MIR:   RET_ReallyLR implicit $x0
entry:
; CHECK-LABEL: E_ctor_base:
; CHECK-NOT: b {{_?B_ctor_complete}}
  %b = getelementptr inbounds %struct.E, %struct.E* %this, i32 0, i32 0
  %call = tail call %struct.B* @B_ctor_complete(%struct.B* returned %b, i32 %x)
  %b2 = getelementptr inbounds %struct.E, %struct.E* %this, i32 0, i32 1
  %call2 = tail call %struct.B* @B_ctor_complete(%struct.B* returned %b2, i32 %x)
  ret %struct.E* %this
}