1 ; RUN: llc -x86-tile-ra=0 -verify-machineinstrs -O3 -use-registers-for-deopt-values -restrict-statepoint-remat=true -pass-remarks-filter=regalloc -pass-remarks-output=%t.yaml -stop-after=greedy -o - < %s 2>&1 | FileCheck %s
2 ; RUN: cat %t.yaml | FileCheck -check-prefix=YAML %s
4 target triple = "x86_64-unknown-linux-gnu"
6 ;CHECK-NOT: error: ran out of registers during register allocation
10 ;YAML: Name: SpillReloadCopies
11 ;YAML: Function: barney
13 ;YAML: - NumSpills: '10'
14 ;YAML: - String: ' spills '
15 ;YAML: - TotalSpillsCost: '7.000000e+00'
16 ;YAML: - String: ' total spills cost '
17 ;YAML: - NumReloads: '7'
18 ;YAML: - String: ' reloads '
19 ;YAML: - TotalReloadsCost: '3.108624e-15'
20 ;YAML: - String: ' total reloads cost '
21 ;YAML: - NumZeroCostFoldedReloads: '20'
22 ;YAML: - String: ' zero cost folded reloads '
23 ;YAML: - String: generated in function
25 define void @barney(ptr addrspace(1) %arg, double %arg1, double %arg2, double %arg3, double %arg4, double %arg5, double %arg6, double %arg7, double %arg8, double %arg9, double %arg10, double %arg11, double %arg12) gc "statepoint-example" personality ptr @widget {
27 %tmp = call coldcc token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr nonnull elementtype(void ()) @blam, i32 0, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 1, i32 0, i32 0, i32 0, i32 26, i32 0, i32 0, ptr addrspace(1) %arg, i32 4, double %arg1, i32 7, ptr null, i32 4, double %arg2, i32 7, ptr null, i32 4, double %arg3, i32 7, ptr null, i32 4, double %arg4, i32 7, ptr null, i32 4, double %arg5, i32 7, ptr null, i32 4, double %arg6, i32 7, ptr null, i32 4, double %arg7, i32 7, ptr null, i32 4, double %arg8, i32 7, ptr null, i32 4, double %arg9, i32 7, ptr null, i32 4, double %arg10, i32 7, ptr null, i32 4, double %arg11, i32 7, ptr null, i32 4, double %arg12, i32 7, ptr null, i32 7, ptr null), "gc-live"(ptr addrspace(1) %arg) ]
28 br i1 undef, label %bb13, label %bb15
31 %tmp14 = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2, i32 5, ptr nonnull elementtype(i32 (ptr addrspace(1), double, double, double, double, double, double, double, double, double)) @quux, i32 10, i32 0, ptr addrspace(1) nonnull null, double %arg1, double %arg2, double %arg3, double %arg5, double %arg6, double %arg7, double %arg9, double %arg10, double %arg11, i32 0, i32 0) [ "deopt"(i32 0, i32 2, i32 0, i32 70, i32 0, i32 26, i32 0, i32 0, ptr addrspace(1) null, i32 4, double %arg1, i32 7, ptr null, i32 4, double %arg2, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 4, double %arg4, i32 7, ptr null, i32 4, double %arg5, i32 7, ptr null, i32 4, double %arg6, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 4, double %arg8, i32 7, ptr null, i32 4, double %arg9, i32 7, ptr null, i32 4, double %arg10, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 4, double %arg12, i32 7, ptr null, i32 7, ptr null), "gc-live"(ptr addrspace(1) null) ]
34 bb15: ; preds = %bb13, %bb
35 %tmp16 = phi double [ %arg4, %bb13 ], [ 1.000000e+00, %bb ]
36 %tmp17 = phi double [ %arg8, %bb13 ], [ 1.000000e+00, %bb ]
37 %tmp18 = phi double [ %arg12, %bb13 ], [ 1.000000e+00, %bb ]
38 br i1 undef, label %bb25, label %bb19
41 %tmp20 = invoke token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 1, i32 16, ptr nonnull elementtype(i32 (i32, ptr addrspace(1), i32)) @eggs, i32 3, i32 0, i32 undef, ptr addrspace(1) nonnull undef, i32 0, i32 0, i32 0) [ "deopt"(i32 0, i32 2, i32 0, i32 97, i32 0, i32 26, i32 0, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 0, i32 2, i32 3, i32 0, i32 20, i32 0, i32 0, ptr addrspace(1) undef, i32 4, double %arg1, i32 7, ptr null, i32 4, double %arg2, i32 7, ptr null, i32 4, double %tmp16, i32 7, ptr null, i32 4, double %arg5, i32 7, ptr null, i32 4, double %arg6, i32 7, ptr null, i32 4, double %tmp17, i32 7, ptr null, i32 4, double %arg9, i32 7, ptr null, i32 4, double %arg10, i32 7, ptr null, i32 4, double %tmp18, i32 7, ptr null, i32 7, ptr null), "gc-live"(ptr addrspace(1) undef) ]
42 to label %bb21 unwind label %bb23
45 %tmp22 = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2, i32 5, ptr nonnull elementtype(void (ptr addrspace(1), double, double, double, double, double, double, double, double, double, i32)) @ham, i32 11, i32 0, ptr addrspace(1) nonnull undef, double %arg1, double %arg2, double %tmp16, double %arg5, double %arg6, double %tmp17, double %arg9, double %arg10, double %tmp18, i32 51, i32 0, i32 0) [ "deopt"(i32 0, i32 2, i32 0, i32 97, i32 0, i32 26, i32 0, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 2, i32 2, i32 46, i32 0, i32 20, i32 0, i32 0, ptr addrspace(1) undef, i32 4, double %arg1, i32 7, ptr null, i32 4, double %arg2, i32 7, ptr null, i32 4, double %tmp16, i32 7, ptr null, i32 4, double %arg5, i32 7, ptr null, i32 4, double %arg6, i32 7, ptr null, i32 4, double %tmp17, i32 7, ptr null, i32 4, double %arg9, i32 7, ptr null, i32 4, double %arg10, i32 7, ptr null, i32 4, double %tmp18, i32 7, ptr null, i32 3, i32 51), "gc-live"(ptr addrspace(1) undef) ]
49 %tmp24 = landingpad token
58 declare i32 @quux(ptr addrspace(1), double, double, double, double, double, double, double, double, double)
60 declare i32 @eggs(i32, ptr addrspace(1), i32)
61 declare void @ham(ptr addrspace(1), double, double, double, double, double, double, double, double, double, i32)
62 declare token @llvm.experimental.gc.statepoint.p0(i64 , i32 , ptr, i32 , i32 , ...)
66 ;CHECK: successors: %bb.2(0x40000000), %bb.1(0x40000000)
67 ;CHECK: liveins: $rdi, $xmm0, $xmm1, $xmm2, $xmm3, $xmm4, $xmm5, $xmm6, $xmm7
68 ;CHECK: %55:fr64 = COPY $xmm7
69 ;CHECK: %10:fr64 = COPY $xmm6
70 ;CHECK: %45:fr64 = COPY $xmm5
71 ;CHECK: %52:fr64 = COPY $xmm4
72 ;CHECK: %59:fr64 = COPY $xmm3
73 ;CHECK: %6:fr64 = COPY $xmm2
74 ;CHECK: %64:fr64 = COPY $xmm1
75 ;CHECK: %68:fr64 = COPY $xmm0
76 ;CHECK: %3:gr64 = COPY $rdi
77 ;CHECK: %82:fr64 = MOVSDrm_alt %fixed-stack.0, 1, $noreg, 0, $noreg :: (load (s64) from %fixed-stack.0)
78 ;CHECK: %14:fr64 = MOVSDrm_alt %fixed-stack.1, 1, $noreg, 0, $noreg :: (load (s64) from %fixed-stack.1, align 16)
79 ;CHECK: %72:fr64 = MOVSDrm_alt %fixed-stack.2, 1, $noreg, 0, $noreg :: (load (s64) from %fixed-stack.2)
80 ;CHECK: %77:fr64 = MOVSDrm_alt %fixed-stack.3, 1, $noreg, 0, $noreg :: (load (s64) from %fixed-stack.3, align 16)
81 ;CHECK: MOV64mr %stack.0, 1, $noreg, 0, $noreg, %3 :: (store (s64) into %stack.0)
82 ;CHECK: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
83 ;CHECK: STATEPOINT 2882400000, 0, 0, target-flags(x86-plt) @blam, 2, 9, 2, 0, 2, 59, 2, 0, 2, 1, 2, 0, 2, 0, 2, 0, 2, 26, 2, 0, 2, 0, 1, 8, %stack.0, 0, 2, 4, %68, 2, 7, 2, 0, 2, 4, %64, 2, 7, 2, 0, 2, 4, %6, 2, 7, 2, 0, 2, 4, %59, 2, 7, 2, 0, 2, 4, %52, 2, 7, 2, 0, 2, 4, %45, 2, 7, 2, 0, 2, 4, %10, 2, 7, 2, 0, 2, 4, %55, 2, 7, 2, 0, 2, 4, %77, 2, 7, 2, 0, 2, 4, %72, 2, 7, 2, 0, 2, 4, %14, 2, 7, 2, 0, 2, 4, %82, 2, 7, 2, 0, 2, 7, 2, 0, 2, 1, 1, 8, %stack.0, 0, 2, 0, 2, 1, 0, 0, csr_64_mostregs, implicit-def $rsp, implicit-def $ssp :: (volatile load store (s64) on %stack.0)
84 ;CHECK: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
85 ;CHECK: %17:gr32 = MOV32r0 implicit-def dead $eflags
86 ;CHECK: TEST8rr %17.sub_8bit, %17.sub_8bit, implicit-def $eflags
87 ;CHECK: MOVSDmr %stack.1, 1, $noreg, 0, $noreg, %45 :: (store (s64) into %stack.1)
88 ;CHECK: MOVSDmr %stack.2, 1, $noreg, 0, $noreg, %52 :: (store (s64) into %stack.2)
89 ;CHECK: MOVSDmr %stack.5, 1, $noreg, 0, $noreg, %64 :: (store (s64) into %stack.5)
90 ;CHECK: MOVSDmr %stack.6, 1, $noreg, 0, $noreg, %68 :: (store (s64) into %stack.6)
91 ;CHECK: JCC_1 %bb.2, 4, implicit killed $eflags
93 ;CHECK: successors: %bb.3(0x80000000)
94 ;CHECK: %60:fr64 = MOVSDrm_alt $rip, 1, $noreg, %const.0, $noreg :: (load (s64) from constant-pool)
95 ;CHECK: MOVSDmr %stack.3, 1, $noreg, 0, $noreg, %60 :: (store (s64) into %stack.3)
96 ;CHECK: MOVSDmr %stack.4, 1, $noreg, 0, $noreg, %60 :: (store (s64) into %stack.4)
97 ;CHECK: MOVSDmr %stack.7, 1, $noreg, 0, $noreg, %60 :: (store (s64) into %stack.7)
100 ;CHECK: successors: %bb.3(0x80000000)
101 ;CHECK: ADJCALLSTACKDOWN64 8, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
102 ;CHECK: MOVSDmr $rsp, 1, $noreg, 0, $noreg, %14 :: (store (s64) into stack)
103 ;CHECK: dead $edi = MOV32r0 implicit-def dead $eflags, implicit-def $rdi
104 ;CHECK: $xmm0 = COPY %68
105 ;CHECK: $xmm1 = COPY %64
106 ;CHECK: $xmm2 = COPY %6
107 ;CHECK: $xmm3 = COPY %52
108 ;CHECK: $xmm4 = COPY %45
109 ;CHECK: $xmm5 = COPY %10
110 ;CHECK: $xmm6 = COPY %77
111 ;CHECK: $xmm7 = COPY %72
112 ;CHECK: MOVSDmr %stack.3, 1, $noreg, 0, $noreg, %55 :: (store (s64) into %stack.3)
113 ;CHECK: MOVSDmr %stack.4, 1, $noreg, 0, $noreg, %59 :: (store (s64) into %stack.4)
114 ;CHECK: MOVSDmr %stack.7, 1, $noreg, 0, $noreg, %82 :: (store (s64) into %stack.7)
115 ;CHECK: STATEPOINT 2, 5, 9, undef %22:gr64, $rdi, $xmm0, $xmm1, $xmm2, $xmm3, $xmm4, $xmm5, $xmm6, $xmm7, 2, 0, 2, 0, 2, 59, 2, 0, 2, 2, 2, 0, 2, 70, 2, 0, 2, 26, 2, 0, 2, 0, 2, 0, 2, 4, 1, 8, %stack.6, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.5, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.4, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.2, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.1, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.3, 0, 2, 7, 2, 0, 2, 4, 1, 8, %fixed-stack.3, 0, 2, 7, 2, 0, 2, 4, 1, 8, %fixed-stack.2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 4, 1, 8, %fixed-stack.0, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 1, 2, 0, 2, 0, 2, 1, 0, 0, csr_64, implicit-def $rsp, implicit-def $ssp, implicit-def dead $eax :: (load (s64) from %stack.1), (load (s64) from %stack.2), (load (s64) from %stack.3), (load (s64) from %stack.4), (load (s64) from %stack.5), (load (s64) from %stack.6), (load (s64) from %fixed-stack.2), (load (s64) from %fixed-stack.3, align 16), (load (s64) from %fixed-stack.0)
116 ;CHECK: ADJCALLSTACKUP64 8, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
118 ;CHECK: successors: %bb.7(0x7ffff800), %bb.4(0x00000800)
119 ;CHECK: %24:gr32 = MOV32r0 implicit-def dead $eflags
120 ;CHECK: TEST8rr %24.sub_8bit, %24.sub_8bit, implicit-def $eflags
121 ;CHECK: JCC_1 %bb.7, 5, implicit killed $eflags
124 ;CHECK: successors: %bb.5(0x00000000), %bb.6(0x80000000)
125 ;CHECK: EH_LABEL <mcsymbol >
126 ;CHECK: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
127 ;CHECK: $edx = MOV32r0 implicit-def dead $eflags
128 ;CHECK: STATEPOINT 1, 16, 3, undef %29:gr64, undef $edi, undef $rsi, $edx, 2, 0, 2, 0, 2, 105, 2, 0, 2, 2, 2, 0, 2, 97, 2, 0, 2, 26, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 0, 2, 2, 2, 3, 2, 0, 2, 20, 2, 0, 2, 0, 2, 4278124286, 2, 4, 1, 8, %stack.6, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.5, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.4, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.2, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.1, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.3, 0, 2, 7, 2, 0, 2, 4, 1, 8, %fixed-stack.3, 0, 2, 7, 2, 0, 2, 4, 1, 8, %fixed-stack.2, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.7, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 1, 2, 4278124286, 2, 0, 2, 1, 0, 0, csr_64, implicit-def $rsp, implicit-def $ssp, implicit-def dead $eax :: (load (s64) from %stack.1), (load (s64) from %stack.2), (load (s64) from %stack.3), (load (s64) from %stack.4), (load (s64) from %stack.5), (load (s64) from %stack.6), (load (s64) from %fixed-stack.2), (load (s64) from %fixed-stack.3, align 16), (load (s64) from %stack.7)
129 ;CHECK: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
130 ;CHECK: EH_LABEL <mcsymbol >
134 ;CHECK: ADJCALLSTACKDOWN64 8, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
135 ;CHECK: %85:fr64 = MOVSDrm_alt %stack.7, 1, $noreg, 0, $noreg :: (load (s64) from %stack.7)
136 ;CHECK: MOVSDmr $rsp, 1, $noreg, 0, $noreg, %85 :: (store (s64) into stack)
137 ;CHECK: $xmm0 = MOVSDrm_alt %stack.6, 1, $noreg, 0, $noreg :: (load (s64) from %stack.6)
138 ;CHECK: $xmm1 = MOVSDrm_alt %stack.5, 1, $noreg, 0, $noreg :: (load (s64) from %stack.5)
139 ;CHECK: $xmm2 = MOVSDrm_alt %stack.4, 1, $noreg, 0, $noreg :: (load (s64) from %stack.4)
140 ;CHECK: $xmm3 = MOVSDrm_alt %stack.2, 1, $noreg, 0, $noreg :: (load (s64) from %stack.2)
141 ;CHECK: $xmm4 = MOVSDrm_alt %stack.1, 1, $noreg, 0, $noreg :: (load (s64) from %stack.1)
142 ;CHECK: $xmm5 = MOVSDrm_alt %stack.3, 1, $noreg, 0, $noreg :: (load (s64) from %stack.3)
143 ;CHECK: %80:fr64 = MOVSDrm_alt %fixed-stack.3, 1, $noreg, 0, $noreg :: (load (s64) from %fixed-stack.3, align 16)
144 ;CHECK: $xmm6 = COPY %80
145 ;CHECK: $esi = MOV32ri 51
146 ;CHECK: %75:fr64 = MOVSDrm_alt %fixed-stack.2, 1, $noreg, 0, $noreg :: (load (s64) from %fixed-stack.2)
147 ;CHECK: $xmm7 = COPY %75
148 ;CHECK: STATEPOINT 2, 5, 10, undef %36:gr64, undef $rdi, $xmm0, $xmm1, $xmm2, $xmm3, $xmm4, $xmm5, $xmm6, $xmm7, killed $esi, 2, 0, 2, 0, 2, 105, 2, 0, 2, 2, 2, 0, 2, 97, 2, 0, 2, 26, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 7, 2, 0, 2, 2, 2, 2, 2, 46, 2, 0, 2, 20, 2, 0, 2, 0, 2, 4278124286, 2, 4, 1, 8, %stack.6, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.5, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.4, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.2, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.1, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.3, 0, 2, 7, 2, 0, 2, 4, 1, 8, %fixed-stack.3, 0, 2, 7, 2, 0, 2, 4, 1, 8, %fixed-stack.2, 0, 2, 7, 2, 0, 2, 4, 1, 8, %stack.7, 0, 2, 7, 2, 0, 2, 3, 2, 51, 2, 1, 2, 4278124286, 2, 0, 2, 1, 0, 0, csr_64, implicit-def $rsp, implicit-def $ssp :: (load (s64) from %stack.1), (load (s64) from %stack.2), (load (s64) from %stack.3), (load (s64) from %stack.4), (load (s64) from %stack.5), (load (s64) from %stack.6), (load (s64) from %fixed-stack.2), (load (s64) from %fixed-stack.3, align 16), (load (s64) from %stack.7)
149 ;CHECK: ADJCALLSTACKUP64 8, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
150 ;CHECK: bb.6.bb23 (landing-pad):
151 ;CHECK: liveins: $rax, $rdx
152 ;CHECK: EH_LABEL <mcsymbol >