[llvm-dev] Debug Locations for Optimized Code

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 6 20:38:50 PST 2016

Hi Kostya,

So... a bunch of folks (not all CC'd - feel free to add anyone who seems
relevant, I haven't gone back over the commits to check who's made what
changes) have been making improvements to optimized code debug information
- much of it around making sure sample profiles are accurate.

This mostly entails removing debug locations from instructions that are
moved between basic blocks.

The justification for this has usually been backed up by "it'll make users
debug experience better too" because the debugger won't jump around so
much, or give users misleading situations like "why am I stepped into a
line of code in the 'if' block when the condition was clearly false"
(because we raised a load that was done in both blocks up to before the
branch and had to pick one of the two locations for it)

This may lead to reduction in quality of debug info for other uses - in
particular in ASan and MSan at least.

ASan and MSan care a lot about loads and stores and the location where
those came from - less so about whether the load or store was sunk into or
out of a loop, etc. Dropping the locations entirely means the user has far
less information about which load or store caused the invalid memory
access. (The 'if' case is still tricky and would be confusing to a *San
user as it was to a debug user.)

I don't know what the right, if any, solution to this is - but I thought I
should bring it up in case you or anyone else wanted to puzzle it over &
see if the competing needs/desires might need to be considered.

- Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161207/60f68366/attachment.html>

More information about the llvm-dev mailing list