1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -x mir -run-pass fixup-statepoint-caller-saved -verify-machineinstrs < %s | FileCheck %s
3 # RUN: llc -x mir -start-before fixup-statepoint-caller-saved -verify-machineinstrs < %s | FileCheck %s -check-prefix=STACKMAP
6 ; ModuleID = 'undef.ll'
7 source_filename = "test_undef.ll"
8 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
9 target triple = "x86_64-unknown-linux-gnu"
11 define void @test_undef(ptr addrspace(1) %arg1, ptr addrspace(1) %arg2, ptr addrspace(1) %arg3, ptr addrspace(1) %arg4) #0 gc "statepoint-example" {
13 %tmp1 = lshr i32 0, undef
14 %tmp2 = load atomic i32, ptr addrspace(1) undef unordered, align 8
15 %tmp3 = load atomic i32, ptr addrspace(1) undef unordered, align 8
19 %tmp4 = icmp slt i32 %tmp3, undef
20 %tmp5 = select i1 %tmp4, i32 6, i32 undef
21 %tmp6 = add i32 %tmp5, %tmp2
22 %tmp7 = call ptr addrspace(1) @wombat()
23 %tmp20 = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2, i32 5, ptr nonnull elementtype(void (ptr addrspace(1), i32, i32, ptr addrspace(1), i32)) @hoge, i32 5, i32 0, ptr addrspace(1) %arg3, i32 %tmp2, i32 %tmp6, ptr addrspace(1) %tmp7, i32 0, i32 0, i32 0) [ "deopt"(ptr addrspace(1) %arg2, ptr addrspace(1) %arg1, ptr addrspace(1) %arg3, ptr addrspace(1) %arg4, i32 %tmp2, i32 %tmp1, i32 %tmp5), "gc-live"() ]
27 declare void @hoge(ptr addrspace(1), i32, i32, ptr addrspace(1), i32) #0
29 declare ptr addrspace(1) @wombat() #0
31 ; Function Attrs: nounwind readonly
32 declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32 immarg, i32 immarg) #1
34 declare token @llvm.experimental.gc.statepoint.p0(i64 immarg, i32 immarg, ptr, i32 immarg, i32 immarg, ...) #0
36 attributes #0 = { "target-cpu"="broadwell" }
37 attributes #1 = { nounwind readonly "target-cpu"="broadwell" }
43 exposesReturnsTwice: false
45 regBankSelected: false
48 tracksRegLiveness: true
52 - { reg: '$rdi', virtual-reg: '' }
53 - { reg: '$rsi', virtual-reg: '' }
54 - { reg: '$rdx', virtual-reg: '' }
55 - { reg: '$rcx', virtual-reg: '' }
57 isFrameAddressTaken: false
58 isReturnAddressTaken: false
67 maxCallFrameSize: 4294967295
68 cvBytesOfCalleeSavedRegisters: 0
69 hasOpaqueSPAdjustment: false
71 hasMustTailInVarArgFunc: false
77 - { id: 0, name: '', type: default, offset: 0, size: 8, alignment: 8,
78 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
79 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
80 - { id: 1, name: '', type: default, offset: 0, size: 8, alignment: 8,
81 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
82 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
83 - { id: 2, name: '', type: default, offset: 0, size: 8, alignment: 8,
84 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
85 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
86 - { id: 3, name: '', type: default, offset: 0, size: 8, alignment: 8,
87 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
88 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
90 debugValueSubstitutions: []
92 machineFunctionInfo: {}
94 ; CHECK-LABEL: name: test_undef
96 ; CHECK: successors: %bb.1(0x80000000)
97 ; CHECK: liveins: $rcx, $rdi, $rdx, $rsi
98 ; CHECK: renamable $r15 = COPY $rcx
99 ; CHECK: renamable $r14 = COPY $rdx
100 ; CHECK: renamable $r13 = COPY $rsi
101 ; CHECK: renamable $r12 = COPY $rdi
102 ; CHECK: renamable $ebx = MOV32rm undef renamable $rax, 1, $noreg, 0, $noreg, implicit-def $rbx :: (load unordered (s32) from `ptr addrspace(1) undef`, align 8, addrspace 1)
104 ; CHECK: liveins: $rbx, $r12, $r13, $r14, $r15
105 ; CHECK: renamable $ebp = LEA64_32r renamable $rbx, 1, $noreg, 6, $noreg
106 ; CHECK: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
107 ; CHECK: CALL64pcrel32 target-flags(x86-plt) @wombat, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax
108 ; CHECK: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
109 ; CHECK: MOV64mr %stack.0, 1, $noreg, 0, $noreg, killed renamable $r13 :: (store (s64) into %stack.0)
110 ; CHECK: MOV64mr %stack.1, 1, $noreg, 0, $noreg, killed renamable $r12 :: (store (s64) into %stack.1)
111 ; CHECK: MOV64mr %stack.2, 1, $noreg, 0, $noreg, renamable $r14 :: (store (s64) into %stack.2)
112 ; CHECK: MOV64mr %stack.3, 1, $noreg, 0, $noreg, killed renamable $r15 :: (store (s64) into %stack.3)
113 ; CHECK: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
114 ; CHECK: $rdi = COPY killed renamable $r14
115 ; CHECK: $esi = COPY renamable $ebx
116 ; CHECK: $edx = COPY killed renamable $ebp
117 ; CHECK: $rcx = COPY killed renamable $rax
118 ; CHECK: $r8d = MOV32r0 implicit-def dead $eflags
119 ; CHECK: STATEPOINT 2, 5, 5, undef renamable $rax, $rdi, $esi, $edx, $rcx, killed $r8d, 2, 0, 2, 0, 2, 7, 1, 8, %stack.0, 0, 1, 8, %stack.1, 0, 1, 8, %stack.2, 0, 1, 8, %stack.3, 0, renamable $ebx, undef renamable $eax, 2, 6, 2, 0, 2, 0, 2, 0, csr_64, implicit-def $rsp, implicit-def $ssp, implicit killed $rbx :: (volatile load store (s64) on %stack.0), (volatile load store (s64) on %stack.1), (volatile load store (s64) on %stack.2), (volatile load store (s64) on %stack.3)
120 ; CHECK: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
122 ; STACKMAP-LABEL: __LLVM_StackMaps:
123 ; STACKMAP-NEXT: .byte 3
124 ; STACKMAP-NEXT: .byte 0
125 ; STACKMAP-NEXT: .short 0
126 ; STACKMAP-NEXT: .long 1
127 ; STACKMAP-NEXT: .long 0
128 ; STACKMAP-NEXT: .long 1
129 ; STACKMAP-NEXT: .quad test_undef
130 ; STACKMAP-NEXT: .quad 88
131 ; STACKMAP-NEXT: .quad 1
132 ; STACKMAP-NEXT: .quad 2
133 ; STACKMAP-NEXT: .long .Ltmp0-test_undef
134 ; STACKMAP-NEXT: .short 0
135 ; STACKMAP-NEXT: .short 10
136 ; STACKMAP-NEXT: .byte 4
137 ; STACKMAP-NEXT: .byte 0
138 ; STACKMAP-NEXT: .short 8
139 ; STACKMAP-NEXT: .short 0
140 ; STACKMAP-NEXT: .short 0
141 ; STACKMAP-NEXT: .long 0
142 ; STACKMAP-NEXT: .byte 4
143 ; STACKMAP-NEXT: .byte 0
144 ; STACKMAP-NEXT: .short 8
145 ; STACKMAP-NEXT: .short 0
146 ; STACKMAP-NEXT: .short 0
147 ; STACKMAP-NEXT: .long 0
148 ; STACKMAP-NEXT: .byte 4
149 ; STACKMAP-NEXT: .byte 0
150 ; STACKMAP-NEXT: .short 8
151 ; STACKMAP-NEXT: .short 0
152 ; STACKMAP-NEXT: .short 0
153 ; STACKMAP-NEXT: .long 7
154 ; STACKMAP-NEXT: .byte 3
155 ; STACKMAP-NEXT: .byte 0
156 ; STACKMAP-NEXT: .short 8
157 ; STACKMAP-NEXT: .short 7
158 ; STACKMAP-NEXT: .short 0
159 ; STACKMAP-NEXT: .long 32
160 ; STACKMAP-NEXT: .byte 3
161 ; STACKMAP-NEXT: .byte 0
162 ; STACKMAP-NEXT: .short 8
163 ; STACKMAP-NEXT: .short 7
164 ; STACKMAP-NEXT: .short 0
165 ; STACKMAP-NEXT: .long 24
166 ; STACKMAP-NEXT: .byte 3
167 ; STACKMAP-NEXT: .byte 0
168 ; STACKMAP-NEXT: .short 8
169 ; STACKMAP-NEXT: .short 7
170 ; STACKMAP-NEXT: .short 0
171 ; STACKMAP-NEXT: .long 16
172 ; STACKMAP-NEXT: .byte 3
173 ; STACKMAP-NEXT: .byte 0
174 ; STACKMAP-NEXT: .short 8
175 ; STACKMAP-NEXT: .short 7
176 ; STACKMAP-NEXT: .short 0
177 ; STACKMAP-NEXT: .long 8
178 ; STACKMAP-NEXT: .byte 1
179 ; STACKMAP-NEXT: .byte 0
180 ; STACKMAP-NEXT: .short 4
181 ; STACKMAP-NEXT: .short 3
182 ; STACKMAP-NEXT: .short 0
183 ; STACKMAP-NEXT: .long 0
184 ; This is a constant 0xFEFEFEFE we are looking for
185 ; STACKMAP-NEXT: .byte 4
186 ; STACKMAP-NEXT: .byte 0
187 ; STACKMAP-NEXT: .short 8
188 ; STACKMAP-NEXT: .short 0
189 ; STACKMAP-NEXT: .short 0
190 ; STACKMAP-NEXT: .long -16843010
191 ; STACKMAP-NEXT: .byte 4
192 ; STACKMAP-NEXT: .byte 0
193 ; STACKMAP-NEXT: .short 8
194 ; STACKMAP-NEXT: .short 0
195 ; STACKMAP-NEXT: .short 0
196 ; STACKMAP-NEXT: .long 6
197 ; STACKMAP-NEXT: .p2align 3
198 ; STACKMAP-NEXT: .short 0
199 ; STACKMAP-NEXT: .short 0
200 ; STACKMAP-NEXT: .p2align 3
202 successors: %bb.1(0x80000000)
203 liveins: $rcx, $rdi, $rdx, $rsi
205 renamable $r15 = COPY $rcx
206 renamable $r14 = COPY $rdx
207 renamable $r13 = COPY $rsi
208 renamable $r12 = COPY $rdi
209 renamable $ebx = MOV32rm undef renamable $rax, 1, $noreg, 0, $noreg, implicit-def $rbx :: (load unordered (s32) from `ptr addrspace(1) undef`, align 8, addrspace 1)
212 liveins: $rbx, $r12, $r13, $r14, $r15
214 renamable $ebp = LEA64_32r renamable $rbx, 1, $noreg, 6, $noreg
215 ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
216 CALL64pcrel32 target-flags(x86-plt) @wombat, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax
217 ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
218 MOV64mr %stack.0, 1, $noreg, 0, $noreg, killed renamable $r13 :: (store (s64) into %stack.0)
219 MOV64mr %stack.1, 1, $noreg, 0, $noreg, killed renamable $r12 :: (store (s64) into %stack.1)
220 MOV64mr %stack.2, 1, $noreg, 0, $noreg, renamable $r14 :: (store (s64) into %stack.2)
221 MOV64mr %stack.3, 1, $noreg, 0, $noreg, killed renamable $r15 :: (store (s64) into %stack.3)
222 ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
223 $rdi = COPY killed renamable $r14
224 $esi = COPY renamable $ebx
225 $edx = COPY killed renamable $ebp
226 $rcx = COPY killed renamable $rax
227 $r8d = MOV32r0 implicit-def dead $eflags
228 STATEPOINT 2, 5, 5, undef renamable $rax, $rdi, $esi, $edx, $rcx, killed $r8d, 2, 0, 2, 0, 2, 7, 1, 8, %stack.0, 0, 1, 8, %stack.1, 0, 1, 8, %stack.2, 0, 1, 8, %stack.3, 0, renamable $ebx, undef renamable $eax, 2, 6, 2, 0, 2, 0, 2, 0, csr_64, implicit-def $rsp, implicit-def $ssp, implicit killed $rbx :: (volatile load store (s64) on %stack.0), (volatile load store (s64) on %stack.1), (volatile load store (s64) on %stack.2), (volatile load store (s64) on %stack.3)
229 ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp