235 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -x mir -run-pass fixup-statepoint-caller-saved -verify-machineinstrs < %s | FileCheck %s3# RUN: llc -x mir -passes='fixup-statepoint-caller-saved' < %s | FileCheck %s4# RUN: llc -x mir -start-before fixup-statepoint-caller-saved -verify-machineinstrs < %s | FileCheck %s -check-prefix=STACKMAP5 6--- |7 ; ModuleID = 'undef.ll'8 source_filename = "test_undef.ll"9 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"10 target triple = "x86_64-unknown-linux-gnu"11 12 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 bb:14 %tmp1 = lshr i32 0, undef15 %tmp2 = load atomic i32, ptr addrspace(1) undef unordered, align 816 %tmp3 = load atomic i32, ptr addrspace(1) undef unordered, align 817 br label %bb718 19 bb7: ; preds = %bb20 %tmp4 = icmp slt i32 %tmp3, undef21 %tmp5 = select i1 %tmp4, i32 6, i32 undef22 %tmp6 = add i32 %tmp5, %tmp223 %tmp7 = call ptr addrspace(1) @wombat()24 %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"() ]25 ret void26 }27 28 declare void @hoge(ptr addrspace(1), i32, i32, ptr addrspace(1), i32) #029 30 declare ptr addrspace(1) @wombat() #031 32 ; Function Attrs: nounwind readonly33 declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32 immarg, i32 immarg) #134 35 declare token @llvm.experimental.gc.statepoint.p0(i64 immarg, i32 immarg, ptr, i32 immarg, i32 immarg, ...) #036 37 attributes #0 = { "target-cpu"="broadwell" }38 attributes #1 = { nounwind readonly "target-cpu"="broadwell" }39 40...41---42name: test_undef43alignment: 1644exposesReturnsTwice: false45legalized: false46regBankSelected: false47selected: false48failedISel: false49tracksRegLiveness: true50hasWinCFI: false51registers: []52liveins:53 - { reg: '$rdi', virtual-reg: '' }54 - { reg: '$rsi', virtual-reg: '' }55 - { reg: '$rdx', virtual-reg: '' }56 - { reg: '$rcx', virtual-reg: '' }57frameInfo:58 isFrameAddressTaken: false59 isReturnAddressTaken: false60 hasStackMap: false61 hasPatchPoint: false62 stackSize: 063 offsetAdjustment: 064 maxAlignment: 865 adjustsStack: true66 hasCalls: true67 stackProtector: ''68 maxCallFrameSize: 429496729569 cvBytesOfCalleeSavedRegisters: 070 hasOpaqueSPAdjustment: false71 hasVAStart: false72 hasMustTailInVarArgFunc: false73 localFrameSize: 074 savePoint: []75 restorePoint: []76fixedStack: []77stack:78 - { id: 0, name: '', type: default, offset: 0, size: 8, alignment: 8,79 stack-id: default, callee-saved-register: '', callee-saved-restored: true,80 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }81 - { id: 1, name: '', type: default, offset: 0, size: 8, alignment: 8,82 stack-id: default, callee-saved-register: '', callee-saved-restored: true,83 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }84 - { id: 2, name: '', type: default, offset: 0, size: 8, alignment: 8,85 stack-id: default, callee-saved-register: '', callee-saved-restored: true,86 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }87 - { id: 3, name: '', type: default, offset: 0, size: 8, alignment: 8,88 stack-id: default, callee-saved-register: '', callee-saved-restored: true,89 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }90callSites: []91debugValueSubstitutions: []92constants: []93machineFunctionInfo: {}94body: |95 ; CHECK-LABEL: name: test_undef96 ; CHECK: bb.0.bb:97 ; CHECK: successors: %bb.1(0x80000000)98 ; CHECK: liveins: $rcx, $rdi, $rdx, $rsi99 ; CHECK: renamable $r15 = COPY $rcx100 ; CHECK: renamable $r14 = COPY $rdx101 ; CHECK: renamable $r13 = COPY $rsi102 ; CHECK: renamable $r12 = COPY $rdi103 ; 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: bb.1.bb7:105 ; CHECK: liveins: $rbx, $r12, $r13, $r14, $r15106 ; CHECK: renamable $ebp = LEA64_32r renamable $rbx, 1, $noreg, 6, $noreg107 ; CHECK: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp108 ; CHECK: CALL64pcrel32 target-flags(x86-plt) @wombat, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax109 ; CHECK: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp110 ; CHECK: MOV64mr %stack.0, 1, $noreg, 0, $noreg, killed renamable $r13 :: (store (s64) into %stack.0)111 ; CHECK: MOV64mr %stack.1, 1, $noreg, 0, $noreg, killed renamable $r12 :: (store (s64) into %stack.1)112 ; CHECK: MOV64mr %stack.2, 1, $noreg, 0, $noreg, renamable $r14 :: (store (s64) into %stack.2)113 ; CHECK: MOV64mr %stack.3, 1, $noreg, 0, $noreg, killed renamable $r15 :: (store (s64) into %stack.3)114 ; CHECK: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp115 ; CHECK: $rdi = COPY killed renamable $r14116 ; CHECK: $esi = COPY renamable $ebx117 ; CHECK: $edx = COPY killed renamable $ebp118 ; CHECK: $rcx = COPY killed renamable $rax119 ; CHECK: $r8d = MOV32r0 implicit-def dead $eflags120 ; 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)121 ; CHECK: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp122 ; CHECK: RET 0123 ; STACKMAP-LABEL: __LLVM_StackMaps:124 ; STACKMAP-NEXT: .byte 3125 ; STACKMAP-NEXT: .byte 0126 ; STACKMAP-NEXT: .short 0127 ; STACKMAP-NEXT: .long 1128 ; STACKMAP-NEXT: .long 0129 ; STACKMAP-NEXT: .long 1130 ; STACKMAP-NEXT: .quad test_undef131 ; STACKMAP-NEXT: .quad 88132 ; STACKMAP-NEXT: .quad 1133 ; STACKMAP-NEXT: .quad 2134 ; STACKMAP-NEXT: .long .Ltmp0-test_undef135 ; STACKMAP-NEXT: .short 0136 ; STACKMAP-NEXT: .short 10137 ; STACKMAP-NEXT: .byte 4138 ; STACKMAP-NEXT: .byte 0139 ; STACKMAP-NEXT: .short 8140 ; STACKMAP-NEXT: .short 0141 ; STACKMAP-NEXT: .short 0142 ; STACKMAP-NEXT: .long 0143 ; STACKMAP-NEXT: .byte 4144 ; STACKMAP-NEXT: .byte 0145 ; STACKMAP-NEXT: .short 8146 ; STACKMAP-NEXT: .short 0147 ; STACKMAP-NEXT: .short 0148 ; STACKMAP-NEXT: .long 0149 ; STACKMAP-NEXT: .byte 4150 ; STACKMAP-NEXT: .byte 0151 ; STACKMAP-NEXT: .short 8152 ; STACKMAP-NEXT: .short 0153 ; STACKMAP-NEXT: .short 0154 ; STACKMAP-NEXT: .long 7155 ; STACKMAP-NEXT: .byte 3156 ; STACKMAP-NEXT: .byte 0157 ; STACKMAP-NEXT: .short 8158 ; STACKMAP-NEXT: .short 7159 ; STACKMAP-NEXT: .short 0160 ; STACKMAP-NEXT: .long 32161 ; STACKMAP-NEXT: .byte 3162 ; STACKMAP-NEXT: .byte 0163 ; STACKMAP-NEXT: .short 8164 ; STACKMAP-NEXT: .short 7165 ; STACKMAP-NEXT: .short 0166 ; STACKMAP-NEXT: .long 24167 ; STACKMAP-NEXT: .byte 3168 ; STACKMAP-NEXT: .byte 0169 ; STACKMAP-NEXT: .short 8170 ; STACKMAP-NEXT: .short 7171 ; STACKMAP-NEXT: .short 0172 ; STACKMAP-NEXT: .long 16173 ; STACKMAP-NEXT: .byte 3174 ; STACKMAP-NEXT: .byte 0175 ; STACKMAP-NEXT: .short 8176 ; STACKMAP-NEXT: .short 7177 ; STACKMAP-NEXT: .short 0178 ; STACKMAP-NEXT: .long 8179 ; STACKMAP-NEXT: .byte 1180 ; STACKMAP-NEXT: .byte 0181 ; STACKMAP-NEXT: .short 4182 ; STACKMAP-NEXT: .short 3183 ; STACKMAP-NEXT: .short 0184 ; STACKMAP-NEXT: .long 0185 ; This is entry we're looking for186 ; STACKMAP-NEXT: .byte 1187 ; STACKMAP-NEXT: .byte 0188 ; STACKMAP-NEXT: .short 4189 ; STACKMAP-NEXT: .short 0190 ; STACKMAP-NEXT: .short 0191 ; STACKMAP-NEXT: .long 0192 ; STACKMAP-NEXT: .byte 4193 ; STACKMAP-NEXT: .byte 0194 ; STACKMAP-NEXT: .short 8195 ; STACKMAP-NEXT: .short 0196 ; STACKMAP-NEXT: .short 0197 ; STACKMAP-NEXT: .long 6198 ; STACKMAP-NEXT: .p2align 3199 ; STACKMAP-NEXT: .short 0200 ; STACKMAP-NEXT: .short 0201 ; STACKMAP-NEXT: .p2align 3202 bb.0.bb:203 successors: %bb.1(0x80000000)204 liveins: $rcx, $rdi, $rdx, $rsi205 206 renamable $r15 = COPY $rcx207 renamable $r14 = COPY $rdx208 renamable $r13 = COPY $rsi209 renamable $r12 = COPY $rdi210 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)211 212 bb.1.bb7:213 liveins: $rbx, $r12, $r13, $r14, $r15214 215 renamable $ebp = LEA64_32r renamable $rbx, 1, $noreg, 6, $noreg216 ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp217 CALL64pcrel32 target-flags(x86-plt) @wombat, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax218 ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp219 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 $ssp224 $rdi = COPY killed renamable $r14225 $esi = COPY renamable $ebx226 $edx = COPY killed renamable $ebp227 $rcx = COPY killed renamable $rax228 $r8d = MOV32r0 implicit-def dead $eflags229 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 $ssp231 RET 0232 233...234 235