[PATCH] Prevent the creation of empty location list ranges.

Frederic Riss friss at apple.com
Tue Dec 2 20:04:12 PST 2014


Hi echristo, dblaikie, aprantl, samsonov,

We happen to create such ranges today depending on teh scheduling of the
DBG_VALUE instructions. An empty range is not only useless, it can also
be a real issue if it happens to span the 0-0 address range (address ranges
in loaction lists are function relative). 0-0 is defined as the end of
location list marker, thus if such a range is generated it will hide the
other entries of the list. A Dwarf consumer like llvm-dwarfdump that
tries to read the .debug_loc section linearly will get totally lost (this
way of reading .debug_loc could arguably be considered a llvm-dwarfdump
bug though).

Note that the patch as-is replaces a std::pair by a struct containing 'first'
and 'second' members. I did this to expose only the logic changes in this
patch. I can do proper renaming as a first step if we agree on the patch's
direction.

Note also that the patch doesn't contain a real test for the empty range
deletion. It might be tricky to come up with something, but I can try if
we agree that the patch DTRT. The testing part of this patch is the fixup
of 2 tests that happened to pass by mistake as the variables they were
testing referred to invalid empty location lists. Once these ranges gone,
the variable is gone too. I XFAILed one test that wouldn't test anything
if modified and I removed the failing parts of the other one (turns out it
was already failing on linux targets).

http://reviews.llvm.org/D6497

Files:
  lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp
  lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.h
  test/DebugInfo/X86/block-capture.ll
  test/DebugInfo/X86/dbg-value-inlined-parameter.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6497.16849.patch
Type: text/x-patch
Size: 4970 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141203/a78e6235/attachment.bin>


More information about the llvm-commits mailing list