Index: llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h =================================================================== --- llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h +++ llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h @@ -138,6 +138,9 @@ /// Emit a raw unsigned value. virtual void emitUnsigned(uint64_t Value) = 0; + /// Emit a normalized unsigned constant. + void emitConstu(uint64_t Value); + /// Return whether the given machine register is the frame register in the /// current function. virtual bool isFrameRegister(const TargetRegisterInfo &TRI, unsigned MachineReg) = 0; Index: llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp =================================================================== --- llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp +++ llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp @@ -24,6 +24,19 @@ using namespace llvm; +void DwarfExpression::emitConstu(uint64_t Value) { + printf("%llu\n", Value); + if (Value < 32) + emitOp(dwarf::DW_OP_lit0 + Value); + else if (Value == ~0U) { + emitOp(dwarf::DW_OP_lit0); + emitOp(dwarf::DW_OP_not); + } else { + emitOp(dwarf::DW_OP_constu); + emitUnsigned(Value); + } +} + void DwarfExpression::addReg(int DwarfReg, const char *Comment) { assert(DwarfReg >= 0 && "invalid negative dwarf register number"); assert((LocationKind == Unknown || LocationKind == Register) && @@ -72,14 +85,12 @@ } void DwarfExpression::addShr(unsigned ShiftBy) { - emitOp(dwarf::DW_OP_constu); - emitUnsigned(ShiftBy); + emitConstu(ShiftBy); emitOp(dwarf::DW_OP_shr); } void DwarfExpression::addAnd(unsigned Mask) { - emitOp(dwarf::DW_OP_constu); - emitUnsigned(Mask); + emitConstu(Mask); emitOp(dwarf::DW_OP_and); } @@ -181,8 +192,7 @@ void DwarfExpression::addUnsignedConstant(uint64_t Value) { assert(LocationKind == Implicit || LocationKind == Unknown); LocationKind = Implicit; - emitOp(dwarf::DW_OP_constu); - emitUnsigned(Value); + emitConstu(Value); } void DwarfExpression::addUnsignedConstant(const APInt &Value) { @@ -373,8 +383,7 @@ break; case dwarf::DW_OP_constu: assert(LocationKind != Register); - emitOp(dwarf::DW_OP_constu); - emitUnsigned(Op->getArg(0)); + emitConstu(Op->getArg(0)); break; case dwarf::DW_OP_stack_value: LocationKind = Implicit; Index: llvm/test/DebugInfo/AMDGPU/variable-locations.ll =================================================================== --- llvm/test/DebugInfo/AMDGPU/variable-locations.ll +++ llvm/test/DebugInfo/AMDGPU/variable-locations.ll @@ -36,15 +36,15 @@ define amdgpu_kernel void @kernel1( ; CHECK: {{.*}}DW_TAG_formal_parameter -; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +4, DW_OP_constu 0x1, DW_OP_swap, DW_OP_xderef) +; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +4, DW_OP_lit1, DW_OP_swap, DW_OP_xderef) ; CHECK-NEXT: DW_AT_name {{.*}}"ArgN" i32 %ArgN, ; CHECK: {{.*}}DW_TAG_formal_parameter -; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +8, DW_OP_constu 0x1, DW_OP_swap, DW_OP_xderef) +; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +8, DW_OP_lit1, DW_OP_swap, DW_OP_xderef) ; CHECK-NEXT: DW_AT_name {{.*}}"ArgA" i32 addrspace(1)* %ArgA, ; CHECK: {{.*}}DW_TAG_formal_parameter -; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +16, DW_OP_constu 0x1, DW_OP_swap, DW_OP_xderef) +; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +16, DW_OP_lit1, DW_OP_swap, DW_OP_xderef) ; CHECK-NEXT: DW_AT_name {{.*}}"ArgB" i32 addrspace(1)* %ArgB) !dbg !13 { entry: Index: llvm/test/DebugInfo/ARM/PR26163.ll =================================================================== --- llvm/test/DebugInfo/ARM/PR26163.ll +++ llvm/test/DebugInfo/ARM/PR26163.ll @@ -9,8 +9,8 @@ ; CHECK: DW_TAG_inlined_subroutine ; CHECK: DW_TAG_variable ; CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}} -; CHECK: [0x00000004, 0x00000004): DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x8 -; CHECK: [0x00000004, 0x00000014): DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4) +; CHECK: [0x00000004, 0x00000004): DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x8 +; CHECK: [0x00000004, 0x00000014): DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4) ; Created form the following test case (PR26163) with ; clang -cc1 -triple armv4t--freebsd11.0-gnueabi -emit-obj -debug-info-kind=standalone -O2 -x c test.c Index: llvm/test/DebugInfo/ARM/split-complex.ll =================================================================== --- llvm/test/DebugInfo/ARM/split-complex.ll +++ llvm/test/DebugInfo/ARM/split-complex.ll @@ -14,7 +14,7 @@ ; The target has no native double type. ; SROA split the complex value into two i64 values. ; CHECK: DW_TAG_formal_parameter - ; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_constu 0x0, DW_OP_piece 0x8) + ; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_lit0, DW_OP_piece 0x8) ; CHECK-NEXT: DW_AT_name {{.*}} "c" tail call void @llvm.dbg.value(metadata i64 0, metadata !14, metadata !17), !dbg !16 ; Manually removed to disable location list emission: Index: llvm/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll =================================================================== --- llvm/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll +++ llvm/test/DebugInfo/Generic/incorrect-variable-debugloc1.ll @@ -1,6 +1,6 @@ ; REQUIRES: object-emission ; This test is failing for powerpc64, because a location list for the -; variable 'c' is not generated at all. Temporary marking this test as XFAIL +; variable 'c' is not generated at all. Temporary marking this test as XFAIL ; for powerpc, until PR21881 is fixed. ; XFAIL: powerpc64 @@ -9,13 +9,14 @@ ; RUN: %llc_dwarf -O2 -dwarf-version 4 -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF4 ; This is a test for PR21176. -; DW_OP_const doesn't describe a constant value, but a value at a constant address. +; DW_OP_const doesn't describe a constant value, but a value at a constant address. ; The proper way to describe a constant value is DW_OP_constu , DW_OP_stack_value. +; For values < 32 we emit the canonical DW_OP_lit. ; Generated with clang -S -emit-llvm -g -O2 test.cpp ; extern int func(); -; +; ; int main() ; { ; volatile int c = 13; @@ -26,8 +27,8 @@ ; CHECK: DW_TAG_variable ; CHECK: DW_AT_location ; CHECK-NOT: DW_AT -; DWARF23: DW_OP_constu 0xd{{$}} -; DWARF4: DW_OP_constu 0xd, DW_OP_stack_value{{$}} +; DWARF23: DW_OP_lit13{{$}} +; DWARF4: DW_OP_lit13, DW_OP_stack_value{{$}} ; Function Attrs: uwtable define i32 @main() #0 !dbg !4 { Index: llvm/test/DebugInfo/X86/PR26148.ll =================================================================== --- llvm/test/DebugInfo/X86/PR26148.ll +++ llvm/test/DebugInfo/X86/PR26148.ll @@ -19,8 +19,8 @@ ; AS in 26163, we expect two ranges (as opposed to one), the first one being zero sized ; ; -; CHECK: [0x0000000000000004, 0x0000000000000004): DW_OP_constu 0x3, DW_OP_piece 0x4, DW_OP_reg5 RDI, DW_OP_piece 0x2 -; CHECK: [0x0000000000000004, 0x0000000000000014): DW_OP_constu 0x3, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_piece 0x4 +; CHECK: [0x0000000000000004, 0x0000000000000004): DW_OP_lit3, DW_OP_piece 0x4, DW_OP_reg5 RDI, DW_OP_piece 0x2 +; CHECK: [0x0000000000000004, 0x0000000000000014): DW_OP_lit3, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_piece 0x4 source_filename = "test/DebugInfo/X86/PR26148.ll" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" Index: llvm/test/DebugInfo/X86/constant-loclist.ll =================================================================== --- llvm/test/DebugInfo/X86/constant-loclist.ll +++ llvm/test/DebugInfo/X86/constant-loclist.ll @@ -14,7 +14,7 @@ ; CHECK-NEXT: DW_AT_name {{.*}}"i" ; CHECK: DW_TAG_variable ; CHECK-NEXT: DW_AT_location [DW_FORM_data4] ( -; CHECK-NEXT: [0x{{.*}}, 0x{{.*}}): DW_OP_constu 0x0 +; CHECK-NEXT: [0x{{.*}}, 0x{{.*}}): DW_OP_lit0 ; CHECK-NEXT: [0x{{.*}}, 0x{{.*}}): DW_OP_constu 0x4000000000000000) ; CHECK-NEXT: DW_AT_name {{.*}}"u" Index: llvm/test/DebugInfo/X86/dw_op_minus.s =================================================================== --- /dev/null +++ llvm/test/DebugInfo/X86/dw_op_minus.s @@ -0,0 +1,243 @@ + .text + .file "dw_op_minus.ll" + .globl f # -- Begin function f + .p2align 4, 0x90 + .type f,@function +f: # @f +.Lfunc_begin0: + .file 1 "/tmp/1.cc" + .loc 1 4 0 # 1.cc:4:0 + .cfi_startproc +# %bb.0: # %entry + subq $24, %rsp + .cfi_def_cfa_offset 32 + movq __safestack_unsafe_stack_ptr@GOTTPOFF(%rip), %rax + movq %fs:(%rax), %rcx +.Ltmp0: + #DEBUG_VALUE: f:buf <- [DW_OP_constu 400, DW_OP_minus] [$rcx+0] + movq %rcx, %rdx + addq $-400, %rdx # imm = 0xFE70 + movq %rdx, %fs:(%rax) +.Ltmp1: + .loc 1 6 3 prologue_end # 1.cc:6:3 + movq %rdx, %rdi + movq %rax, 16(%rsp) # 8-byte Spill + movq %rcx, 8(%rsp) # 8-byte Spill +.Ltmp2: + #DEBUG_VALUE: f:buf <- [DW_OP_plus_uconst 8, DW_OP_deref, DW_OP_constu 400, DW_OP_minus] [$rsp+0] + callq Capture + .loc 1 7 1 # 1.cc:7:1 + movq 16(%rsp), %rax # 8-byte Reload + movq 8(%rsp), %rcx # 8-byte Reload + movq %rcx, %fs:(%rax) + addq $24, %rsp +.Ltmp3: + .cfi_def_cfa_offset 8 + retq +.Ltmp4: +.Lfunc_end0: + .size f, .Lfunc_end0-f + .cfi_endproc + # -- End function + .section .debug_str,"MS",@progbits,1 +.Linfo_string0: + .asciz "clang version 3.8.0 (trunk 248518) (llvm/trunk 248512)" # string offset=0 +.Linfo_string1: + .asciz "1.cc" # string offset=55 +.Linfo_string2: + .asciz "/tmp" # string offset=60 +.Linfo_string3: + .asciz "f" # string offset=65 +.Linfo_string4: + .asciz "buf" # string offset=67 +.Linfo_string5: + .asciz "int" # string offset=71 +.Linfo_string6: + .asciz "__ARRAY_SIZE_TYPE__" # string offset=75 + .section .debug_loc,"",@progbits +.Ldebug_loc0: + .quad .Ltmp0-.Lfunc_begin0 + .quad .Ltmp2-.Lfunc_begin0 + .short 3 # Loc expr size + .byte 114 # DW_OP_breg2 + .byte 240 # -400 + .byte 124 # + .quad .Ltmp2-.Lfunc_begin0 + .quad .Ltmp3-.Lfunc_begin0 + .short 7 # Loc expr size + .byte 119 # DW_OP_breg7 + .byte 8 # 8 + .byte 6 # DW_OP_deref + .byte 16 # DW_OP_constu + .byte 144 # 400 + .byte 3 # + .byte 28 # DW_OP_minus + .quad 0 + .quad 0 + .section .debug_abbrev,"",@progbits + .byte 1 # Abbreviation Code + .byte 17 # DW_TAG_compile_unit + .byte 1 # DW_CHILDREN_yes + .byte 37 # DW_AT_producer + .byte 14 # DW_FORM_strp + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 16 # DW_AT_stmt_list + .byte 23 # DW_FORM_sec_offset + .byte 27 # DW_AT_comp_dir + .byte 14 # DW_FORM_strp + .ascii "\264B" # DW_AT_GNU_pubnames + .byte 25 # DW_FORM_flag_present + .byte 17 # DW_AT_low_pc + .byte 1 # DW_FORM_addr + .byte 18 # DW_AT_high_pc + .byte 6 # DW_FORM_data4 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 2 # Abbreviation Code + .byte 46 # DW_TAG_subprogram + .byte 1 # DW_CHILDREN_yes + .byte 17 # DW_AT_low_pc + .byte 1 # DW_FORM_addr + .byte 18 # DW_AT_high_pc + .byte 6 # DW_FORM_data4 + .byte 64 # DW_AT_frame_base + .byte 24 # DW_FORM_exprloc + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 63 # DW_AT_external + .byte 25 # DW_FORM_flag_present + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 3 # Abbreviation Code + .byte 52 # DW_TAG_variable + .byte 0 # DW_CHILDREN_no + .byte 2 # DW_AT_location + .byte 23 # DW_FORM_sec_offset + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 4 # Abbreviation Code + .byte 1 # DW_TAG_array_type + .byte 1 # DW_CHILDREN_yes + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 5 # Abbreviation Code + .byte 33 # DW_TAG_subrange_type + .byte 0 # DW_CHILDREN_no + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 55 # DW_AT_count + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 6 # Abbreviation Code + .byte 36 # DW_TAG_base_type + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 62 # DW_AT_encoding + .byte 11 # DW_FORM_data1 + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 7 # Abbreviation Code + .byte 36 # DW_TAG_base_type + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 62 # DW_AT_encoding + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 0 # EOM(3) + .section .debug_info,"",@progbits +.Lcu_begin0: + .long 102 # Length of Unit + .short 4 # DWARF version number + .long .debug_abbrev # Offset Into Abbrev. Section + .byte 8 # Address Size (in bytes) + .byte 1 # Abbrev [1] 0xb:0x5f DW_TAG_compile_unit + .long .Linfo_string0 # DW_AT_producer + .short 4 # DW_AT_language + .long .Linfo_string1 # DW_AT_name + .long .Lline_table_start0 # DW_AT_stmt_list + .long .Linfo_string2 # DW_AT_comp_dir + # DW_AT_GNU_pubnames + .quad .Lfunc_begin0 # DW_AT_low_pc + .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc + .byte 2 # Abbrev [2] 0x2a:0x25 DW_TAG_subprogram + .quad .Lfunc_begin0 # DW_AT_low_pc + .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc + .byte 1 # DW_AT_frame_base + .byte 87 + .long .Linfo_string3 # DW_AT_name + .byte 1 # DW_AT_decl_file + .byte 4 # DW_AT_decl_line + # DW_AT_external + .byte 3 # Abbrev [3] 0x3f:0xf DW_TAG_variable + .long .Ldebug_loc0 # DW_AT_location + .long .Linfo_string4 # DW_AT_name + .byte 1 # DW_AT_decl_file + .byte 5 # DW_AT_decl_line + .long 79 # DW_AT_type + .byte 0 # End Of Children Mark + .byte 4 # Abbrev [4] 0x4f:0xc DW_TAG_array_type + .long 91 # DW_AT_type + .byte 5 # Abbrev [5] 0x54:0x6 DW_TAG_subrange_type + .long 98 # DW_AT_type + .byte 100 # DW_AT_count + .byte 0 # End Of Children Mark + .byte 6 # Abbrev [6] 0x5b:0x7 DW_TAG_base_type + .long .Linfo_string5 # DW_AT_name + .byte 5 # DW_AT_encoding + .byte 4 # DW_AT_byte_size + .byte 7 # Abbrev [7] 0x62:0x7 DW_TAG_base_type + .long .Linfo_string6 # DW_AT_name + .byte 8 # DW_AT_byte_size + .byte 7 # DW_AT_encoding + .byte 0 # End Of Children Mark + .section .debug_macinfo,"",@progbits + .byte 0 # End Of Macro List Mark + .section .debug_pubnames,"",@progbits + .long .LpubNames_end0-.LpubNames_begin0 # Length of Public Names Info +.LpubNames_begin0: + .short 2 # DWARF Version + .long .Lcu_begin0 # Offset of Compilation Unit Info + .long 106 # Compilation Unit Length + .long 42 # DIE offset + .asciz "f" # External Name + .long 0 # End Mark +.LpubNames_end0: + .section .debug_pubtypes,"",@progbits + .long .LpubTypes_end0-.LpubTypes_begin0 # Length of Public Types Info +.LpubTypes_begin0: + .short 2 # DWARF Version + .long .Lcu_begin0 # Offset of Compilation Unit Info + .long 106 # Compilation Unit Length + .long 91 # DIE offset + .asciz "int" # External Name + .long 0 # End Mark +.LpubTypes_end0: + + .section ".note.GNU-stack","",@progbits + .section .debug_line,"",@progbits +.Lline_table_start0: Index: llvm/test/DebugInfo/X86/dw_op_minus_direct.ll =================================================================== --- llvm/test/DebugInfo/X86/dw_op_minus_direct.ll +++ llvm/test/DebugInfo/X86/dw_op_minus_direct.ll @@ -17,7 +17,7 @@ ; CHECK: .debug_loc contents: ; CHECK: 0x00000000: -; CHECK-NEXT: [0x0000000000000000, 0x0000000000000004): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_constu 0x1, DW_OP_minus, DW_OP_stack_value +; CHECK-NEXT: [0x0000000000000000, 0x0000000000000004): DW_OP_breg0 RAX+0, DW_OP_lit0, DW_OP_not, DW_OP_and, DW_OP_lit1, DW_OP_minus, DW_OP_stack_value ; rax+0, constu 0xffffffff, and, constu 0x00000001, minus, stack-value source_filename = "minus.c" Index: llvm/test/DebugInfo/X86/partial-constant.ll =================================================================== --- llvm/test/DebugInfo/X86/partial-constant.ll +++ llvm/test/DebugInfo/X86/partial-constant.ll @@ -18,7 +18,7 @@ ; CHECK-NOT: DW_AT_const_value ; CHECK: .debug_loc contents: ; CHECK-NEXT: 0x00000000: -; CHECK-NEXT: {{.*}}: DW_OP_constu 0x1, DW_OP_stack_value +; CHECK-NEXT: {{.*}}: DW_OP_lit1, DW_OP_stack_value source_filename = "test.ii" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" Index: llvm/test/DebugInfo/X86/pieces-4.ll =================================================================== --- llvm/test/DebugInfo/X86/pieces-4.ll +++ llvm/test/DebugInfo/X86/pieces-4.ll @@ -25,7 +25,7 @@ ; DWARF: .debug_loc contents: ; DWARF-NEXT: 0x00000000: -; DWARF-NEXT: {{.*}}: DW_OP_breg7 RSP+{{[0-9]+}}, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4 +; DWARF-NEXT: {{.*}}: DW_OP_breg7 RSP+{{[0-9]+}}, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4 ; ModuleID = 't.c' source_filename = "t.c" Index: llvm/test/DebugInfo/X86/split-global.ll =================================================================== --- llvm/test/DebugInfo/X86/split-global.ll +++ llvm/test/DebugInfo/X86/split-global.ll @@ -17,13 +17,13 @@ ; CHECK: DW_TAG_variable ; CHECK-NEXT: DW_AT_name {{.*}}"part_const" ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x8, DW_OP_piece 0x4, DW_OP_constu 0x2, DW_OP_stack_value, DW_OP_piece 0x4) +; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x8, DW_OP_piece 0x4, DW_OP_lit2, DW_OP_stack_value, DW_OP_piece 0x4) ; [0x0000000000000008], piece 0x00000004, constu 0x00000002, stack-value, piece 0x00000004 ; CHECK-NOT: DW_TAG ; CHECK: DW_TAG_variable ; CHECK-NEXT: DW_AT_name {{.*}}"full_const" ; CHECK-NOT: DW_TAG -; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_constu 0x1, DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_constu 0x2, DW_OP_stack_value, DW_OP_piece 0x4) +; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_lit1, DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_lit2, DW_OP_stack_value, DW_OP_piece 0x4) ; CHECK-NOT: DW_TAG @point.y = global i32 2, align 4, !dbg !13 @point.x = global i32 1, align 4, !dbg !12 Index: llvm/test/DebugInfo/X86/stack-value-dwarf4.ll =================================================================== --- llvm/test/DebugInfo/X86/stack-value-dwarf4.ll +++ llvm/test/DebugInfo/X86/stack-value-dwarf4.ll @@ -6,25 +6,23 @@ target datalayout = "e-p:64:64" target triple = "x86_64-unknown-linux-gnu" -; CHECK-DWARF2: .byte 8 # DW_AT_location -; CHECK-DWARF2 .byte 16 -; CHECK-DWARF2 .byte 4 -; CHECK-DWARF2 .byte 147 -; CHECK-DWARF2 .byte 2 -; CHECK-DWARF2 .byte 16 -; CHECK-DWARF2 .byte 0 -; CHECK-DWARF2 .byte 147 -; CHECK-DWARF2 .byte 2 +; CHECK-DWARF2: .byte 6 # DW_AT_location +; CHECK-DWARF2-NEXT: .byte 52 +; CHECK-DWARF2-NEXT: .byte 147 +; CHECK-DWARF2-NEXT: .byte 2 +; CHECK-DWARF2-NEXT: .byte 48 +; CHECK-DWARF2-NEXT: .byte 147 +; CHECK-DWARF2-NEXT: .byte 2 -; CHECK-DWARF4: .byte 10 # DW_AT_location -; CHECK-DWARF4-NEXT: .byte 16 -; CHECK-DWARF4-NEXT: .byte 4 -; CHECK-DWARF4-NEXT: .byte 159 -; CHECK-DWARF4-NEXT: .byte 147 -; CHECK-DWARF4-NEXT: .byte 2 -; CHECK-DWARF4-NEXT: .byte 16 -; CHECK-DWARF4-NEXT: .byte 0 -; CHECK-DWARF4-NEXT: .byte 159 +; CHECK-DWARF4: .byte 8 # DW_AT_location +; CHECK-DWARF4-NEXT:.byte 52 +; CHECK-DWARF4-NEXT:.byte 159 +; CHECK-DWARF4-NEXT:.byte 147 +; CHECK-DWARF4-NEXT:.byte 2 +; CHECK-DWARF4-NEXT:.byte 48 +; CHECK-DWARF4-NEXT:.byte 159 +; CHECK-DWARF4-NEXT:.byte 147 +; CHECK-DWARF4-NEXT:.byte 2 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang", file: !4, globals: !1, emissionKind: FullDebug) !1 = !{!2, !10} Index: llvm/test/DebugInfo/X86/stack-value-piece.ll =================================================================== --- llvm/test/DebugInfo/X86/stack-value-piece.ll +++ llvm/test/DebugInfo/X86/stack-value-piece.ll @@ -19,21 +19,21 @@ ; CHECK: DW_AT_name {{.*}} "i" ; CHECK: DW_TAG_variable ; CHECK-NEXT: DW_AT_location {{.*}} ([[I:.*]] -; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4) +; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4) ; CHECK-NEXT: DW_AT_name {{.*}} "r" ; ; CHECK: DW_TAG_subprogram ; CHECK: DW_AT_name {{.*}} "f" ; CHECK: DW_TAG_variable ; CHECK-NEXT: DW_AT_location {{.*}} ([[F:.*]] -; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg17 XMM0, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4) +; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg17 XMM0, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4) ; CHECK-NEXT: DW_AT_name {{.*}} "r" ; ; CHECK: .debug_loc contents: ; CHECK: [[I]]: -; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4 +; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4 ; CHECK: [[F]]: -; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg17 XMM0, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4 +; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg17 XMM0, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4 source_filename = "stack-value-piece.c" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"