File: deref-spills-with-size.mir

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (371 lines) | stat: -rw-r--r-- 20,355 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# RUN: llc %s -o - -experimental-debug-variable-locations=true \
# RUN:   -run-pass=livedebugvalues \
# RUN: | FileCheck %s --implicit-check-not=DBG_VALUE
# RUN: llc %s -o - -experimental-debug-variable-locations=true \
# RUN:   -start-before=livedebugvalues -filetype=obj \
# RUN: | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF
#
# LLVM can produce DIExpressions that convert from one value of arbitrary size
# to another. This is normally fine, however that means the value for a
# variable tracked in instruction referencing might not be the same size as the
# variable itself.
#
# This becomes a problem when values move onto the stack and we emit
# DW_OP_deref: there is no information about how large a value the consumer
# should load from the stack. The convention today appears to be the size of
# the variable, and as a result if you have a value that's smaller than the
# variable size, extra information is loaded onto the DWARF expression stack.
# This then appears as a false variable value to the consumer.
#
# In this test, there are various scenarios to test where the size of the value
# needs to reach the expression emitter in LiveDebugValues. However, there are
# even more scenarios to consider where the value is in a spill slot, and:
#  * The value is larger than the variable, the same, or smaller,
#  * The variable is a normal scalar, or a fragment,
#  * There is a DW_OP_stack_value in the expression, or not
# That gives us twelve situations to consider, and the easiest way to confirm
# correctness is to write them all out. The final DWARF expressions to
# produce are:
# * No stack value,
#   * Scalar (32 bits),
#     * Larger value (64 bits)
#       DW_OP_breg7 RSP-8, DW_OP_deref_size 0x8, DW_OP_stack_value
#     * Same value (32 bits)
#       DW_OP_breg7 RSP-8
#     * Smaller value (8 bits)
#       DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_stack_value
#   * Fragment (32 bits)
#     * Larger value (64 bits)
#       DW_OP_breg7 RSP-8, DW_OP_deref_size 0x8, DW_OP_stack_value, DW_OP_piece 0x4
#     * Same value (32 bits)
#       DW_OP_breg7 RSP-8, DW_OP_piece 0x4
#     * Smaller value (8 bits)
#       DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_stack_value, DW_OP_piece 0x4
# * Stack value (imagine there was some arithmetic on the stack before the
#   DW_OP_stack_value opcode),
#   * Scalar (32 bits),
#     * Larger value (64 bits)
#       DW_OP_breg7 RSP-8, DW_OP_deref_size 0x8, DW_OP_stack_value
#     * Same value (32 bits)
#       DW_OP_breg7 RSP-8, DW_OP_deref, DW_OP_stack_value
#     * Smaller value (8 bits)
#       DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_stack_value
#   * Fragment (32 bits)
#     * Larger value (64 bits)
#       DW_OP_breg7 RSP-8, DW_OP_deref_size 0x8, DW_OP_stack_value, DW_OP_piece 0x4
#     * Same value (32 bits)
#       DW_OP_breg7 RSP-8, DW_OP_deref_size 0x4, DW_OP_stack_value, DW_OP_piece 0x4
#     * Smaller value (8 bits)
#       DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_stack_value, DW_OP_piece 0x4
#
# The outlier from the pattern is (Stack value, Fragment, Same value size): we
# put a DW_OP_deref_size in where a DW_OP_deref could have sufficied. However,
# if we used DW_OP_deref, it would force the consumer to derive the deref size
# from the DW_OP_piece, which is un-necessarily hard.

## Capture variable num,
# CHECK-DAG: ![[VARNUM:[0-9]+]] = !DILocalVariable(name: "flannel",
# CHECK-DAG: ![[VARNUM2:[0-9]+]] = !DILocalVariable(name: "shoes",

# DWARF:      DW_TAG_variable
# DWARF-NEXT: DW_AT_location
## Defined in register, spilt to stack.
# DWARF-NEXT: DW_OP_breg0 RAX+0, DW_OP_constu 0xff, DW_OP_and, DW_OP_convert (0x00000026) "DW_ATE_signed_8", DW_OP_convert (0x0000002a) "DW_ATE_signed_32", DW_OP_stack_value
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_convert (0x00000026) "DW_ATE_signed_8", DW_OP_convert (0x0000002a) "DW_ATE_signed_32", DW_OP_stack_value
## Defined on stack.
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_convert (0x00000026) "DW_ATE_signed_8", DW_OP_convert (0x0000002a) "DW_ATE_signed_32", DW_OP_stack_value
## DBG_PHI that moves to stack.
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_stack_value
## DBG_PHI of stack with size.
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x2, DW_OP_stack_value
## Followed by scalar / no-stack-value locations with various sizes.
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x8, DW_OP_stack_value
# DWARF-NEXT: DW_OP_breg7 RSP-8
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_stack_value
## scalar / stack value with various sizes.
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x8, DW_OP_lit1, DW_OP_plus, DW_OP_stack_value
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref, DW_OP_lit1, DW_OP_plus, DW_OP_stack_value
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_lit1, DW_OP_plus, DW_OP_stack_value)
# DWARF:      DW_AT_name ("flannel")

# Variable with fragments.
# DWARF:      DW_TAG_variable
# DWARF-NEXT: DW_AT_location
## Scalar / no-stack-value locations with various sizes.
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x8, DW_OP_stack_value, DW_OP_piece 0x4
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_piece 0x4
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_stack_value, DW_OP_piece 0x4
## Scalar / stack value with various sizes.
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x8, DW_OP_lit1, DW_OP_plus, DW_OP_stack_value, DW_OP_piece 0x4
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x4, DW_OP_lit1, DW_OP_plus, DW_OP_stack_value, DW_OP_piece 0x4
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_lit1, DW_OP_plus, DW_OP_stack_value, DW_OP_piece 0x4)
# DWARF:      DW_AT_name ("shoes")

--- |
  ; ModuleID = 'missingvar.ll'
  source_filename = "a"
  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-unknown-linux-gnu"
  
  define linkonce_odr void @_ZNSt5dequeIPN4llvm4LoopESaIS2_EE13_M_insert_auxESt15_Deque_iteratorIS2_RS2_PS2_EmRKS2_() local_unnamed_addr align 2 !dbg !3 {
  entry:
    call void @llvm.dbg.value(metadata i32 0, metadata !8, metadata !DIExpression()), !dbg !7
    call void @llvm.dbg.value(metadata i32 0, metadata !10, metadata !DIExpression()), !dbg !7
    ret void
  }

  declare void @llvm.dbg.value(metadata, metadata, metadata)
  
  !llvm.module.flags = !{!0, !9}
  !llvm.dbg.cu = !{!1}
  
  !0 = !{i32 2, !"Debug Info Version", i32 3}
  !1 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !2, producer: "beards", isOptimized: true, runtimeVersion: 4, emissionKind: FullDebug)
  !2 = !DIFile(filename: "bees.cpp", directory: "")
  !3 = distinct !DISubprogram(name: "nope", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1)
  !4 = !DISubroutineType(types: !5)
  !5 = !{!6}
  !6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  !7 = !DILocation(line: 1, scope: !3)
  !8 = !DILocalVariable(name: "flannel", scope: !3, type: !6)
  !9 = !{i32 2, !"Dwarf Version", i32 5}
  !10 = !DILocalVariable(name: "shoes", scope: !3, type: !11)
  !11 = !DIBasicType(name: "long", size: 64, encoding: DW_ATE_signed)


...
---
name:            _ZNSt5dequeIPN4llvm4LoopESaIS2_EE13_M_insert_auxESt15_Deque_iteratorIS2_RS2_PS2_EmRKS2_
alignment:       16
tracksRegLiveness: true
liveins:
  - { reg: '$rdi' }
  - { reg: '$rsi' }
  - { reg: '$rdx' }
frameInfo:
  stackSize:       48
  offsetAdjustment: -48
  maxAlignment:    8
  maxCallFrameSize: 0
  cvBytesOfCalleeSavedRegisters: 48
fixedStack:
  - { id: 0, type: spill-slot, offset: -56, size: 8, alignment: 8, callee-saved-register: '$rbx' }
  - { id: 1, type: spill-slot, offset: -48, size: 8, alignment: 16, callee-saved-register: '$r12' }
  - { id: 2, type: spill-slot, offset: -40, size: 8, alignment: 8, callee-saved-register: '$r13' }
  - { id: 3, type: spill-slot, offset: -32, size: 8, alignment: 16, callee-saved-register: '$r14' }
  - { id: 4, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$r15' }
  - { id: 5, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$rbp' }
stack:
  - { id: 0, type: spill-slot, offset: -64, size: 8, alignment: 8 }
machineFunctionInfo: {}
body:             |
  bb.0.entry:
    liveins: $rdi, $rdx, $rsi, $rbp, $r15, $r14, $r13, $r12, $rbx
  
    ; CHECK-LABEL: bb.0.entry:

    ;; PART ONE: For this first block of tests, check that information about
    ;; the size of the value on the stack makes it through to the expression.

    $al = MOV8ri 0, debug-instr-number 1, debug-location !7
    DBG_INSTR_REF 1, 0, !8, !DIExpression(DW_OP_LLVM_convert, 8, DW_ATE_signed, DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_stack_value), debug-location !7
    ; CHECK:      DBG_VALUE $al, $noreg, ![[VARNUM]],
    ; CHECK-SAME: !DIExpression(DW_OP_LLVM_convert, 8, DW_ATE_signed,
    ; CHECK-SAME     : DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_stack_value)

    MOV8mr $rsp, 1, $noreg, -8, $noreg, renamable $al :: (store 1 into %stack.0)
    ;; Clobber to force variable location onto stack. We should use a
    ;; deref_size 1 because the value is smaller than the variable.
    $al = MOV8ri 0, debug-location !7
    ; CHECK:      DBG_VALUE $rsp, $noreg, ![[VARNUM]],
    ; CHECK-SAME: !DIExpression(DW_OP_constu, 8, DW_OP_minus, 
    ; CHECK-SAME:     DW_OP_deref_size, 1, DW_OP_LLVM_convert, 8, DW_ATE_signed,
    ; CHECK-SAME:     DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_stack_value),

    ; Terminate the current variable location,
    DBG_VALUE $noreg, $noreg, !8, !DIExpression(), debug-location !7
    ; CHECK: DBG_VALUE $noreg, $noreg, ![[VARNUM]], !DIExpression()

    ;; Try again, but with the value originating on the stack, to ensure that
    ;; we can find its size. It should be deref_size 1 again.
    INC8m $rsp, 1, $noreg, 4, $noreg, implicit-def dead $eflags, debug-instr-number 2, debug-location !7 :: (store (s8) into %stack.0)
    DBG_INSTR_REF 2, 1000000, !8, !DIExpression(DW_OP_LLVM_convert, 8, DW_ATE_signed, DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_stack_value), debug-location !7
    ; CHECK:      DBG_VALUE $rsp, $noreg, ![[VARNUM]],
    ; CHECK-SAME: !DIExpression(DW_OP_constu, 8, DW_OP_minus,
    ; CHECK-SAME:     DW_OP_deref_size, 1, DW_OP_LLVM_convert, 8, DW_ATE_signed,
    ; CHECK-SAME:     DW_OP_LLVM_convert, 32, DW_ATE_signed, DW_OP_stack_value),

    $eax = MOV32ri 0, debug-location !7

    ;; How about DBG_PHIs? The size of the value is communicated by the register
    ;; size, or an extra DBG_PHI operand, and that should feed through into the
    ;; decision of whether to deref_size or not.

    DBG_VALUE $noreg, $noreg, !8, !DIExpression(), debug-location !7
    ; CHECK: DBG_VALUE $noreg

    $al = MOV8ri 0, debug-location !7
    DBG_PHI $al, 7

    MOV32mr $rsp, 1, $noreg, -8, $noreg, renamable $eax :: (store 4 into %stack.0)
    $eax = MOV32ri 0, debug-location !7
    DBG_INSTR_REF 7, 0, !8, !DIExpression(), debug-location !7
    ; CHECK:      DBG_VALUE $rsp, $noreg, ![[VARNUM]],
    ; CHECK-SAME: !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 1, DW_OP_stack_value)

    $eax = MOV32ri 0, debug-location !7

    ;; And for when the DBG_PHI specifies a stack size...
    DBG_PHI %stack.0, 8, 16
    DBG_INSTR_REF 8, 0, !8, !DIExpression(), debug-location !7
    ; CHECK:      DBG_VALUE $rsp, $noreg, ![[VARNUM]],
    ; CHECK-SAME: !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 2, DW_OP_stack_value)

    $eax = MOV32ri 0, debug-location !7
    DBG_VALUE $noreg, $noreg, !8, !DIExpression(), debug-location !7
    ; CHECK: DBG_VALUE $noreg, $noreg
    DBG_VALUE $noreg, $noreg, !10, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !7
    ; CHECK: DBG_VALUE $noreg, $noreg

    ;; PART TWO: test the twelve kinds of location expression mentioned in the
    ;; opening comment of this test, in that order. Please update the opening
    ;; comment, these lines and the DWARF check lines at the same time.
    ;; In each test we'll state a location, give it an instruction to cover,
    ;; and then terminate it.

    ;; Scalar (32), Large value (64), no stack value,
    $rax = MOV64ri 0, debug-instr-number 10, debug-location !7
    MOV64mr $rsp, 1, $noreg, -8, $noreg, renamable $rax :: (store 8 into %stack.0)
    $rax = MOV64ri 0, debug-location !7
    DBG_INSTR_REF 10, 0, !8, !DIExpression(), debug-location !7
    ; CHECK:      DBG_VALUE $rsp, $noreg, ![[VARNUM]],
    ; CHECK-SAME: !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 8, DW_OP_stack_value),
    $eax = MOV32ri 0, debug-location !7
    DBG_VALUE $noreg, $noreg, !8, !DIExpression(), debug-location !7
    ; CHECK: DBG_VALUE $noreg, $noreg

    ;; Scalar (32), Same value size (32), no stack value,
    $eax = MOV32ri 0, debug-instr-number 11, debug-location !7
    MOV32mr $rsp, 1, $noreg, -8, $noreg, renamable $eax :: (store 4 into %stack.0)
    $rax = MOV64ri 0, debug-location !7
    DBG_INSTR_REF 11, 0, !8, !DIExpression(), debug-location !7
    ; CHECK:      DBG_VALUE $rsp, 0, ![[VARNUM]],
    ; CHECK-SAME: !DIExpression(DW_OP_constu, 8, DW_OP_minus),
    $eax = MOV32ri 0, debug-location !7
    DBG_VALUE $noreg, $noreg, !8, !DIExpression(), debug-location !7
    ; CHECK: DBG_VALUE $noreg, $noreg

    ;; Scalar (32), Smaller value (8), no stack value,
    $al = MOV8ri 0, debug-instr-number 12, debug-location !7
    MOV8mr $rsp, 1, $noreg, -8, $noreg, renamable $al :: (store 1 into %stack.0)
    $rax = MOV64ri 0, debug-location !7
    DBG_INSTR_REF 12, 0, !8, !DIExpression(), debug-location !7
    ; CHECK:      DBG_VALUE $rsp, $noreg, ![[VARNUM]],
    ; CHECK-SAME: !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 1, DW_OP_stack_value),
    $eax = MOV32ri 0, debug-location !7
    DBG_VALUE $noreg, $noreg, !8, !DIExpression(), debug-location !7
    ; CHECK: DBG_VALUE $noreg, $noreg

    ;; Fragment (32), Larger value (64), no stack value,
    $rax = MOV64ri 0, debug-instr-number 13, debug-location !7
    MOV64mr $rsp, 1, $noreg, -8, $noreg, renamable $rax :: (store 8 into %stack.0)
    $rax = MOV64ri 0, debug-location !7
    DBG_INSTR_REF 13, 0, !10, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !7
    ; CHECK:      DBG_VALUE $rsp, $noreg, ![[VARNUM2]],
    ; CHECK-SAME: !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 8, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32),
    $eax = MOV32ri 0, debug-location !7
    DBG_VALUE $noreg, $noreg, !10, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !7
    ; CHECK: DBG_VALUE $noreg, $noreg

    ;; Fragment (32), Same value size (32), no stack value,
    $eax = MOV32ri 0, debug-instr-number 14, debug-location !7
    MOV32mr $rsp, 1, $noreg, -8, $noreg, renamable $eax :: (store 4 into %stack.0)
    $rax = MOV64ri 0, debug-location !7
    DBG_INSTR_REF 14, 0, !10, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !7
    ; CHECK:      DBG_VALUE $rsp, 0, ![[VARNUM2]],
    ; CHECK-SAME: !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_LLVM_fragment, 0, 32),
    $eax = MOV32ri 0, debug-location !7
    DBG_VALUE $noreg, $noreg, !10, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !7
    ; CHECK: DBG_VALUE $noreg, $noreg

    ;; Fragment (32), Smaller value (8), no stack value,
    $al = MOV8ri 0, debug-instr-number 15, debug-location !7
    MOV8mr $rsp, 1, $noreg, -8, $noreg, renamable $al :: (store 1 into %stack.0)
    $rax = MOV64ri 0, debug-location !7
    DBG_INSTR_REF 15, 0, !10, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !7
    ; CHECK:      DBG_VALUE $rsp, $noreg, ![[VARNUM2]],
    ; CHECK-SAME: !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 1, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32),
    $eax = MOV32ri 0, debug-location !7
    DBG_VALUE $noreg, $noreg, !10, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !7
    ; CHECK: DBG_VALUE $noreg, $noreg



    ;; Scalar (32), Large value (64), with stack value,
    $rax = MOV64ri 0, debug-instr-number 16, debug-location !7
    MOV64mr $rsp, 1, $noreg, -8, $noreg, renamable $rax :: (store 8 into %stack.0)
    $rax = MOV64ri 0, debug-location !7
    DBG_INSTR_REF 16, 0, !8, !DIExpression(DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value), debug-location !7
    ; CHECK:      DBG_VALUE $rsp, $noreg, ![[VARNUM]],
    ; CHECK-SAME: !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 8, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value),
    $eax = MOV32ri 0, debug-location !7
    DBG_VALUE $noreg, $noreg, !8, !DIExpression(), debug-location !7
    ; CHECK: DBG_VALUE $noreg, $noreg

    ;; Scalar (32), Same value size (32), no stack value,
    $eax = MOV32ri 0, debug-instr-number 17, debug-location !7
    MOV32mr $rsp, 1, $noreg, -8, $noreg, renamable $eax :: (store 4 into %stack.0)
    $rax = MOV64ri 0, debug-location !7
    DBG_INSTR_REF 17, 0, !8, !DIExpression(DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value), debug-location !7
    ; CHECK:      DBG_VALUE $rsp, $noreg, ![[VARNUM]],
    ; CHECK-SAME: !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value),
    $eax = MOV32ri 0, debug-location !7
    DBG_VALUE $noreg, $noreg, !8, !DIExpression(), debug-location !7
    ; CHECK: DBG_VALUE $noreg, $noreg

    ;; Scalar (32), Smaller value (8), no stack value,
    $al = MOV8ri 0, debug-instr-number 18, debug-location !7
    MOV8mr $rsp, 1, $noreg, -8, $noreg, renamable $al :: (store 1 into %stack.0)
    $rax = MOV64ri 0, debug-location !7
    DBG_INSTR_REF 18, 0, !8, !DIExpression(DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value), debug-location !7
    ; CHECK:      DBG_VALUE $rsp, $noreg, ![[VARNUM]],
    ; CHECK-SAME: !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 1, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value),
    $eax = MOV32ri 0, debug-location !7
    DBG_VALUE $noreg, $noreg, !8, !DIExpression(), debug-location !7
    ; CHECK: DBG_VALUE $noreg, $noreg

    ;; Fragment (32), Larger value (64), no stack value,
    $rax = MOV64ri 0, debug-instr-number 19, debug-location !7
    MOV64mr $rsp, 1, $noreg, -8, $noreg, renamable $rax :: (store 8 into %stack.0)
    $rax = MOV64ri 0, debug-location !7
    DBG_INSTR_REF 19, 0, !10, !DIExpression(DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32), debug-location !7
    ; CHECK:      DBG_VALUE $rsp, $noreg, ![[VARNUM2]],
    ; CHECK-SAME: !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 8, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32),
    $eax = MOV32ri 0, debug-location !7
    DBG_VALUE $noreg, $noreg, !10, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !7
    ; CHECK: DBG_VALUE $noreg, $noreg

    ;; Fragment (32), Same value size (32), no stack value,
    $eax = MOV32ri 0, debug-instr-number 20, debug-location !7
    MOV32mr $rsp, 1, $noreg, -8, $noreg, renamable $eax :: (store 4 into %stack.0)
    $rax = MOV64ri 0, debug-location !7
    DBG_INSTR_REF 20, 0, !10, !DIExpression(DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32), debug-location !7
    ; CHECK:      DBG_VALUE $rsp, $noreg, ![[VARNUM2]],
    ; CHECK-SAME: !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 4, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32),
    $eax = MOV32ri 0, debug-location !7
    DBG_VALUE $noreg, $noreg, !10, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !7
    ; CHECK: DBG_VALUE $noreg, $noreg

    ;; Fragment (32), Smaller value (8), no stack value,
    $al = MOV8ri 0, debug-instr-number 21, debug-location !7
    MOV8mr $rsp, 1, $noreg, -8, $noreg, renamable $al :: (store 1 into %stack.0)
    $rax = MOV64ri 0, debug-location !7
    DBG_INSTR_REF 21, 0, !10, !DIExpression(DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32), debug-location !7
    ; CHECK:      DBG_VALUE $rsp, $noreg, ![[VARNUM2]],
    ; CHECK-SAME: !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 1, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32),
    $eax = MOV32ri 0, debug-location !7
    DBG_VALUE $noreg, $noreg, !10, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !7
    ; CHECK: DBG_VALUE $noreg, $noreg

    RET64 0, debug-location !7
...