1 ; RUN: llc < %s | FileCheck %s
2 ; RUN: llc -O3 < %s | FileCheck %s
3 ; RUN: llc -O3 -debug-only=stackmaps < %s 2>&1 | FileCheck -check-prefix=STACKMAPS %s
6 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
7 target triple = "x86_64-apple-macosx10.11.0"
10 ; STACKMAPS: Stack Maps: callsite 2882400015
11 ; STACKMAPS-NEXT: Stack Maps: has 4 locations
12 ; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
13 ; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
14 ; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]
15 ; STACKMAPS-NEXT: Stack Maps: Loc 3: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
16 ; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers
17 ; STACKMAPS-NEXT: Stack Maps: callsite 4242
18 ; STACKMAPS-NEXT: Stack Maps: has 4 locations
19 ; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
20 ; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
21 ; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]
22 ; STACKMAPS-NEXT: Stack Maps: Loc 3: Constant 1 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]
23 ; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers
24 ; STACKMAPS-NEXT: Stack Maps: callsite 4243
25 ; STACKMAPS-NEXT: Stack Maps: has 4 locations
26 ; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
27 ; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
28 ; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]
29 ; STACKMAPS-NEXT: Stack Maps: Loc 3: Constant 16 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 16]
30 ; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers
31 ; STACKMAPS-NEXT: Stack Maps: callsite 2882400015
32 ; STACKMAPS-NEXT: Stack Maps: has 4 locations
33 ; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
34 ; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
35 ; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]
36 ; STACKMAPS-NEXT: Stack Maps: Loc 3: Constant 2 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 2]
37 ; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers
38 ; STACKMAPS-NEXT: Stack Maps: callsite 2882400015
39 ; STACKMAPS-NEXT: Stack Maps: has 4 locations
40 ; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
41 ; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
42 ; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]
43 ; STACKMAPS-NEXT: Stack Maps: Loc 3: Constant 3 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 3]
44 ; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers
45 ; STACKMAPS-NEXT: Stack Maps: callsite 4243
46 ; STACKMAPS-NEXT: Stack Maps: has 4 locations
47 ; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
48 ; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
49 ; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]
50 ; STACKMAPS-NEXT: Stack Maps: Loc 3: Constant 55 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 55]
51 ; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers
53 declare i32 @callee_0()
54 declare i32 @callee_1(i32)
55 declare i32 @callee_vararg(...)
57 define i32 @caller_0() {
58 ; CHECK-LABEL: _caller_0
60 %v = call i32 @callee_0() [ "deopt"(i32 0) ]
63 ; CHECK: callq _callee_0
68 define i32 @caller_1() {
69 ; CHECK-LABEL: _caller_1
71 %v = call i32 @callee_1(i32 42) "statepoint-id"="4242" [ "deopt"(i32 1) ]
73 ; CHECK: callq _callee_1
78 define i32 @caller_vararg() {
79 ; CHECK-LABEL: _caller_vararg
82 ; CHECK: callq _callee_vararg
83 %v = call i32(...) @callee_vararg(i32 42, double 500.0) "statepoint-id"="4243" [ "deopt"(i32 16) ]
87 define i32 @invoker_0() personality i8 0 {
88 ; CHECK-LABEL: _invoker_0
90 %v = invoke i32 @callee_0() [ "deopt"(i32 2) ]
91 to label %normal unwind label %uw
97 %ehvals = landingpad { i8*, i32 }
100 ; CHECK: callq _callee_0
103 ; CHECK: movl $1, %eax
108 define i32 @invoker_1() personality i8 0 {
109 ; CHECK-LABEL: _invoker_1
111 %v = invoke i32 @callee_1(i32 45) "statepoint-num-patch-bytes"="9" [ "deopt"(i32 3) ]
112 to label %normal unwind label %uw
118 %ehvals = landingpad { i8*, i32 }
121 ; CHECK: movl $45, %edi
122 ; CHECK: nopw 512(%rax,%rax)
125 ; CHECK: movl $1, %eax
130 define i32 @invoker_2() personality i32 (...)* @__CxxFrameHandler3 {
132 %val = invoke i32 @callee_1(i32 1)
133 to label %try.cont unwind label %catch.dispatch
136 %cs1 = catchswitch within none [label %catch] unwind to caller
139 %cp1 = catchpad within %cs1 [i8* null, i32 64, i8* null]
140 %val2 = call i32 @callee_1(i32 100) "statepoint-id"="4243" [ "funclet"(token %cp1), "deopt"(i32 55) ]
141 catchret from %cp1 to label %try.cont
147 declare i32 @__CxxFrameHandler3(...)
149 define void @f_0(i64 %n) {
152 %vl = alloca i64, i64 %n
153 ; Check that the stackmap does not reference %s through
154 ; SP since the offset is not static because of %vl.
155 ; STACKMAPS: Loc 3: Direct 6
156 call void @g_0(i64* %vl) [ "deopt"(i64* %s) ]
160 declare void @g_0(i64* %vl)
162 define void @vector_deopt_bundle(<32 x i64 addrspace(1)*> %val) {
163 ; CHECK-LABEL: _vector_deopt_bundle:
164 ; CHECK: movaps 16(%rbp), %xmm8
165 ; CHECK-NEXT: movaps 32(%rbp), %xmm9
166 ; CHECK-NEXT: movaps 48(%rbp), %xmm10
167 ; CHECK-NEXT: movaps 64(%rbp), %xmm11
168 ; CHECK-NEXT: movaps 80(%rbp), %xmm12
169 ; CHECK-NEXT: movaps 96(%rbp), %xmm13
170 ; CHECK-NEXT: movaps 112(%rbp), %xmm14
171 ; CHECK-NEXT: movaps 128(%rbp), %xmm15
172 ; CHECK-NEXT: movaps %xmm15, 240(%rsp)
173 ; CHECK-NEXT: movaps %xmm14, 224(%rsp)
174 ; CHECK-NEXT: movaps %xmm13, 208(%rsp)
175 ; CHECK-NEXT: movaps %xmm12, 192(%rsp)
176 ; CHECK-NEXT: movaps %xmm11, 176(%rsp)
177 ; CHECK-NEXT: movaps %xmm10, 160(%rsp)
178 ; CHECK-NEXT: movaps %xmm9, 144(%rsp)
179 ; CHECK-NEXT: movaps %xmm8, 128(%rsp)
180 ; CHECK-NEXT: movaps %xmm7, 112(%rsp)
181 ; CHECK-NEXT: movaps %xmm6, 96(%rsp)
182 ; CHECK-NEXT: movaps %xmm5, 80(%rsp)
183 ; CHECK-NEXT: movaps %xmm4, 64(%rsp)
184 ; CHECK-NEXT: movaps %xmm3, 48(%rsp)
185 ; CHECK-NEXT: movaps %xmm2, 32(%rsp)
186 ; CHECK-NEXT: movaps %xmm1, 16(%rsp)
187 ; CHECK-NEXT: movaps %xmm0, (%rsp)
188 call void @unknown() [ "deopt"(<32 x i64 addrspace(1)*> %val) ]
190 ; STACKMAPS: Stack Maps: callsite 2882400015
191 ; STACKMAPS-NEXT: Stack Maps: has 4 locations
192 ; STACKMAPS-NEXT: Stack Maps: Loc 0: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
193 ; STACKMAPS-NEXT: Stack Maps: Loc 1: Constant 0 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 0]
194 ; STACKMAPS-NEXT: Stack Maps: Loc 2: Constant 1 [encoding: .byte 4, .byte 0, .short 8, .short 0, .short 0, .int 1]
195 ; STACKMAPS-NEXT: Stack Maps: Loc 3: Indirect 7+0 [encoding: .byte 3, .byte 0, .short 256, .short 7, .short 0, .int 0]
196 ; STACKMAPS-NEXT: Stack Maps: has 0 live-out registers
199 declare void @unknown()