This is an archive of the discontinued LLVM Phabricator instance.

[LiveDebugVariables] Avoid faulty addDefsFromCopies in computeIntervals
ClosedPublic

Authored by bjope on Aug 15 2018, 10:08 AM.

Details

Summary

When computeIntervals is looking through COPY instruction to
extend the location mapping for a debug variable it did not
handle subregisters correctly.

For example

DBG_VALUE debug-use %0.sub_8bit_hi, ...
%1:gr16 = COPY %0

was transformed into

DBG_VALUE debug-use %0.sub_8bit_hi, ...
%1:gr16 = COPY %0
DBG_VALUE debug-use %1, ...

So the subregister index was missing in the added DBG_VALUE.

As long as the subreg refered to the least significant bits
of the superreg, then I guess we could get the correct
result in a debugger even when referring to the superreg.
But as in the example above when the subreg refers to other
parts of the superreg, then debuginfo would be incorrect.

I'm not sure exactly how to fix this properly, so this patch
just avoids looking through the COPY when there is a subreg
involved (for more info, see the FIXME added in the code).

Diff Detail

Repository
rL LLVM

Event Timeline

bjope created this revision.Aug 15 2018, 10:08 AM
aprantl accepted this revision.Aug 24 2018, 10:03 AM
This revision is now accepted and ready to land.Aug 24 2018, 10:03 AM
This revision was automatically updated to reflect the committed changes.