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
5 ; ModuleID = 'undef.ll'
6 source_filename = "test_undef.ll"
7 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-unknown-linux-gnu"
10 define void @test_undef(ptr addrspace(1) %arg1, ptr addrspace(1) %arg2, ptr addrspace(1) %arg3, ptr addrspace(1) %arg4) #0 gc "statepoint-example" {
12 %tmp1 = lshr i32 0, undef
13 %tmp2 = load atomic i32, ptr addrspace(1) undef unordered, align 8
14 %tmp3 = load atomic i32, ptr addrspace(1) undef unordered, align 8
15 %tmp19 = inttoptr i64 undef to ptr addrspace(1)
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) %tmp19, i32 %tmp2, i32 %tmp6, ptr addrspace(1) %tmp7, i32 0, i32 0, i32 0) [ "deopt"(ptr addrspace(1) %tmp19, ptr addrspace(1) %arg1, ptr addrspace(1) %arg3, ptr addrspace(1) %arg4, i32 %tmp2, i32 %tmp1, i32 %tmp5), "gc-live"(ptr addrspace(1) %tmp19, ptr addrspace(1) %arg2) ]
24 %tmp21 = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %tmp20, i32 0, i32 0) ; (%tmp19, %tmp19)
25 %tmp22 = call coldcc ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %tmp20, i32 1, i32 1) ; (%arg2, %arg2)
29 declare void @hoge(ptr addrspace(1), i32, i32, ptr addrspace(1), i32) #0
31 declare ptr addrspace(1) @wombat() #0
33 ; Function Attrs: nounwind readonly
34 declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32 immarg, i32 immarg) #1
36 declare token @llvm.experimental.gc.statepoint.p0(i64 immarg, i32 immarg, ptr, i32 immarg, i32 immarg, ...)
38 attributes #0 = { "target-cpu"="broadwell" }
39 attributes #1 = { nounwind readonly }
45 exposesReturnsTwice: false
47 regBankSelected: false
50 tracksRegLiveness: true
54 - { reg: '$rdi', virtual-reg: '' }
55 - { reg: '$rsi', virtual-reg: '' }
56 - { reg: '$rdx', virtual-reg: '' }
57 - { reg: '$rcx', virtual-reg: '' }
59 isFrameAddressTaken: false
60 isReturnAddressTaken: false
69 maxCallFrameSize: 4294967295
70 cvBytesOfCalleeSavedRegisters: 0
71 hasOpaqueSPAdjustment: false
73 hasMustTailInVarArgFunc: false
79 - { id: 0, name: '', type: default, offset: 0, size: 8, alignment: 8,
80 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
81 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
82 - { id: 1, name: '', type: default, offset: 0, size: 8, alignment: 8,
83 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
84 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
85 - { id: 2, name: '', type: default, offset: 0, size: 8, alignment: 8,
86 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
87 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
89 debugValueSubstitutions: []
91 machineFunctionInfo: {}
93 ; CHECK-LABEL: name: test_undef
95 ; CHECK: successors: %bb.1(0x80000000)
96 ; CHECK: liveins: $rcx, $rdi, $rdx, $rsi
97 ; CHECK: renamable $r15 = COPY $rcx
98 ; CHECK: renamable $r12 = COPY $rdx
99 ; CHECK: renamable $r14 = COPY $rsi
100 ; CHECK: renamable $r13 = COPY $rdi
101 ; 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)
103 ; CHECK: liveins: $rbx, $r12, $r13, $r14, $r15
104 ; CHECK: renamable $ebp = LEA64_32r renamable $rbx, 1, $noreg, 6, $noreg
105 ; CHECK: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
106 ; CHECK: CALL64pcrel32 target-flags(x86-plt) @wombat, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax
107 ; CHECK: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
108 ; CHECK: MOV64mr %stack.0, 1, $noreg, 0, $noreg, killed renamable $r13 :: (store (s64) into %stack.0)
109 ; CHECK: MOV64mr %stack.1, 1, $noreg, 0, $noreg, killed renamable $r12 :: (store (s64) into %stack.1)
110 ; CHECK: MOV64mr %stack.2, 1, $noreg, 0, $noreg, killed renamable $r15 :: (store (s64) into %stack.2)
111 ; CHECK: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
112 ; CHECK: $esi = COPY renamable $ebx
113 ; CHECK: $edx = COPY killed renamable $ebp
114 ; CHECK: $rcx = COPY killed renamable $rax
115 ; CHECK: $r8d = MOV32r0 implicit-def dead $eflags
116 ; CHECK: MOV64mr %stack.3, 1, $noreg, 0, $noreg, killed $r14 :: (store (s64) into %stack.3)
117 ; CHECK: STATEPOINT 2, 5, 5, undef renamable $rax, undef $rdi, $esi, $edx, $rcx, killed $r8d, 2, 0, 2, 0, 2, 7, undef renamable $rax, 1, 8, %stack.0, 0, 1, 8, %stack.1, 0, 1, 8, %stack.2, 0, renamable $ebx, undef renamable $eax, 2, 6, 2, 2, 1, 8, %stack.3, 0, undef renamable $rbx, 2, 0, 2, 2, 0, 0, 1, 1, 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), (load store (s64) on %stack.3)
118 ; CHECK: $r14 = MOV64rm %stack.3, 1, $noreg, 0, $noreg :: (load (s64) from %stack.3)
119 ; CHECK: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
122 successors: %bb.1(0x80000000)
123 liveins: $rcx, $rdi, $rdx, $rsi
125 renamable $r15 = COPY $rcx
126 renamable $r12 = COPY $rdx
127 renamable $r14 = COPY $rsi
128 renamable $r13 = COPY $rdi
129 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)
132 liveins: $rbx, $r12, $r13, $r14, $r15
134 renamable $ebp = LEA64_32r renamable $rbx, 1, $noreg, 6, $noreg
135 ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
136 CALL64pcrel32 target-flags(x86-plt) @wombat, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax
137 ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
138 MOV64mr %stack.0, 1, $noreg, 0, $noreg, killed renamable $r13 :: (store (s64) into %stack.0)
139 MOV64mr %stack.1, 1, $noreg, 0, $noreg, killed renamable $r12 :: (store (s64) into %stack.1)
140 MOV64mr %stack.2, 1, $noreg, 0, $noreg, killed renamable $r15 :: (store (s64) into %stack.2)
141 ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
142 $esi = COPY renamable $ebx
143 $edx = COPY killed renamable $ebp
144 $rcx = COPY killed renamable $rax
145 $r8d = MOV32r0 implicit-def dead $eflags
146 dead renamable $r14, dead renamable $rbx = STATEPOINT 2, 5, 5, undef renamable $rax, undef $rdi, $esi, $edx, $rcx, killed $r8d, 2, 0, 2, 0, 2, 7, undef renamable $rax, 1, 8, %stack.0, 0, 1, 8, %stack.1, 0, 1, 8, %stack.2, 0, renamable $ebx, undef renamable $eax, 2, 6, 2, 2, killed renamable $r14(tied-def 0), undef renamable $rbx(tied-def 1), 2, 0, 2, 2, 0, 0, 1, 1, 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)
147 ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp