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 1
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 4278124286
133 ; STACKMAP-NEXT: .quad 2
134 ; STACKMAP-NEXT: .long .Ltmp0-test_undef
135 ; STACKMAP-NEXT: .short 0
136 ; STACKMAP-NEXT: .short 10
137 ; STACKMAP-NEXT: .byte 4
138 ; STACKMAP-NEXT: .byte 0
139 ; STACKMAP-NEXT: .short 8
140 ; STACKMAP-NEXT: .short 0
141 ; STACKMAP-NEXT: .short 0
142 ; STACKMAP-NEXT: .long 0
143 ; STACKMAP-NEXT: .byte 4
144 ; STACKMAP-NEXT: .byte 0
145 ; STACKMAP-NEXT: .short 8
146 ; STACKMAP-NEXT: .short 0
147 ; STACKMAP-NEXT: .short 0
148 ; STACKMAP-NEXT: .long 0
149 ; STACKMAP-NEXT: .byte 4
150 ; STACKMAP-NEXT: .byte 0
151 ; STACKMAP-NEXT: .short 8
152 ; STACKMAP-NEXT: .short 0
153 ; STACKMAP-NEXT: .short 0
154 ; STACKMAP-NEXT: .long 7
155 ; STACKMAP-NEXT: .byte 3
156 ; STACKMAP-NEXT: .byte 0
157 ; STACKMAP-NEXT: .short 8
158 ; STACKMAP-NEXT: .short 7
159 ; STACKMAP-NEXT: .short 0
160 ; STACKMAP-NEXT: .long 32
161 ; STACKMAP-NEXT: .byte 3
162 ; STACKMAP-NEXT: .byte 0
163 ; STACKMAP-NEXT: .short 8
164 ; STACKMAP-NEXT: .short 7
165 ; STACKMAP-NEXT: .short 0
166 ; STACKMAP-NEXT: .long 24
167 ; STACKMAP-NEXT: .byte 3
168 ; STACKMAP-NEXT: .byte 0
169 ; STACKMAP-NEXT: .short 8
170 ; STACKMAP-NEXT: .short 7
171 ; STACKMAP-NEXT: .short 0
172 ; STACKMAP-NEXT: .long 16
173 ; STACKMAP-NEXT: .byte 3
174 ; STACKMAP-NEXT: .byte 0
175 ; STACKMAP-NEXT: .short 8
176 ; STACKMAP-NEXT: .short 7
177 ; STACKMAP-NEXT: .short 0
178 ; STACKMAP-NEXT: .long 8
179 ; STACKMAP-NEXT: .byte 1
180 ; STACKMAP-NEXT: .byte 0
181 ; STACKMAP-NEXT: .short 4
182 ; STACKMAP-NEXT: .short 3
183 ; STACKMAP-NEXT: .short 0
184 ; STACKMAP-NEXT: .long 0
185 ; This is entry we're looking for, reference to constant pool entry 0xFEFEFEFE
186 ; STACKMAP-NEXT: .byte 5
187 ; STACKMAP-NEXT: .byte 0
188 ; STACKMAP-NEXT: .short 8
189 ; STACKMAP-NEXT: .short 0
190 ; STACKMAP-NEXT: .short 0
191 ; STACKMAP-NEXT: .long 0
192 ; STACKMAP-NEXT: .byte 4
193 ; STACKMAP-NEXT: .byte 0
194 ; STACKMAP-NEXT: .short 8
195 ; STACKMAP-NEXT: .short 0
196 ; STACKMAP-NEXT: .short 0
197 ; STACKMAP-NEXT: .long 6
198 ; STACKMAP-NEXT: .p2align 3
199 ; STACKMAP-NEXT: .short 0
200 ; STACKMAP-NEXT: .short 0
201 ; STACKMAP-NEXT: .p2align 3
203 successors: %bb.1(0x80000000)
204 liveins: $rcx, $rdi, $rdx, $rsi
206 renamable $r15 = COPY $rcx
207 renamable $r14 = COPY $rdx
208 renamable $r13 = COPY $rsi
209 renamable $r12 = COPY $rdi
210 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)
213 liveins: $rbx, $r12, $r13, $r14, $r15
215 renamable $ebp = LEA64_32r renamable $rbx, 1, $noreg, 6, $noreg
216 ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
217 CALL64pcrel32 target-flags(x86-plt) @wombat, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax
218 ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
219 MOV64mr %stack.0, 1, $noreg, 0, $noreg, killed renamable $r13 :: (store (s64) into %stack.0)
220 MOV64mr %stack.1, 1, $noreg, 0, $noreg, killed renamable $r12 :: (store (s64) into %stack.1)
221 MOV64mr %stack.2, 1, $noreg, 0, $noreg, renamable $r14 :: (store (s64) into %stack.2)
222 MOV64mr %stack.3, 1, $noreg, 0, $noreg, killed renamable $r15 :: (store (s64) into %stack.3)
223 ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
224 $rdi = COPY killed renamable $r14
225 $esi = COPY renamable $ebx
226 $edx = COPY killed renamable $ebp
227 $rcx = COPY killed renamable $rax
228 $r8d = MOV32r0 implicit-def dead $eflags
229 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)
230 ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp