[llvm-bugs] [Bug 46575] New: llvm-dwarfdump --statistics can miscalculate scope bytes covered
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jul 3 02:55:18 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46575
Bug ID: 46575
Summary: llvm-dwarfdump --statistics can miscalculate scope
bytes covered
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: orlando.hyams at sony.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
Created attachment 23675
--> https://bugs.llvm.org/attachment.cgi?id=23675&action=edit
example.ll
Tools built with trunk f1c671925b1c60ded3e4e7b3c6b1ec984b2d9b93.
For a variable described with a location list, the stat
'sum_all_variables(#bytes in parent scope covered by DW_AT_location)' is
calculated by summing all bytes covered by the location ranges in the list
and capping the result to the number of bytes in the parent scope. No effort is
made to discern whether the bytes covered are 'bytes in parent scope'.
clang seems to produce a fair number of location ranges which cover bytes
outside of the variables scope like this (see D82129).
I've attached an IR file based on the test
llvm/test/DebugInfo/COFF/register-variables.ll which can be compiled with llc
to demonstrate this happening. All dbg.values have been removed except for
variable 'c', so only 'c' has any byte coverage.
$ llc example.ll -filetype=obj -o example.o && llvm-dwarfdump example.o
...
DW_TAG_lexical_block
DW_AT_low_pc (0x0000000000000003)
DW_AT_high_pc (0x0000000000000008)
DW_TAG_variable
DW_AT_location (0x00000000:
[0x0000000000000014, 0x000000000000001c): DW_OP_reg0 RAX)
DW_AT_name ("c")
DW_AT_decl_file ("/t.cpp")
DW_AT_decl_line (15)
DW_AT_type (0x00000044 "int")
Although the DW_AT_location range [0x0000000000000014, 0x000000000000001c)
covers no bytes in the parent scope [0x0000000000000003, 0x0000000000000008),
llvm-dwarfdump reports 5 bytes are covered:
$ llvm-dwarfdump --statistics example.o | python -m json.tool
...
"sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)": 5,
I'd expect to instead see:
"sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)": 0,
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200703/ad401fdc/attachment-0001.html>
More information about the llvm-bugs
mailing list