https://bugs.llvm.org/show_bug.cgi?id=45889

            Bug ID: 45889
           Summary: [DebugInfo] Bloated dwarf for single location variable
                    in nested scope
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

Created attachment 23476
  --> https://bugs.llvm.org/attachment.cgi?id=23476&action=edit
XFAIL llvm-lit test

We get bloated dwarf for a variable location in a nested scope if it also has a
location tracked outside of that scope. I've attached a test case which fails
with llvm built at 72edb7986a8 (12th May 2020).

$ llc -start-after=livedebugvalues --filetype=obj test.mir -o - |
llvm-dwarfdump -
...
DW_TAG_lexical_block
  DW_AT_low_pc  (0x0000000000000002)
  DW_AT_high_pc (0x0000000000000003)

  DW_TAG_variable
    DW_AT_location    (0x00000000: 
       [0x0000000000000000, 0x0000000000000002): DW_OP_reg5 RDI
       [0x0000000000000002, 0x0000000000000003): DW_OP_reg0 RAX)
    DW_AT_name  ("local")
...

Despite the fact that we have a location (DW_OP_reg0 RAX) which covers the
entire lexical block [0x0000000000000002, 0x0000000000000003) in which the
variable lives, we emit a location list. I think we could emit this instead:

DW_TAG_lexical_block
  DW_AT_low_pc  (0x0000000000000002)
  DW_AT_high_pc (0x0000000000000003)

  DW_TAG_variable
    DW_AT_location   (DW_OP_reg0 RAX)
    DW_AT_name       ("local")

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to