diff options
author | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2018-08-25 10:02:03 +0000 |
---|---|---|
committer | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2018-08-25 10:02:03 +0000 |
commit | 8483004723f862684dadc97d0f26885487425a34 (patch) | |
tree | 748e8711a58e4153251e5e94dc02f0a71d1e747b /llvm/lib | |
parent | 353f67a741daa97e94bd402f6394c6d89fd8a987 (diff) | |
download | bcm5719-llvm-8483004723f862684dadc97d0f26885487425a34.tar.gz bcm5719-llvm-8483004723f862684dadc97d0f26885487425a34.zip |
[LiveDebugVariables] Avoid faulty addDefsFromCopies in computeIntervals
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).
Reviewers: rnk, aprantl
Reviewed By: aprantl
Subscribers: JDevlieghere, llvm-commits
Tags: #debug-info
Differential Revision: https://reviews.llvm.org/D50788
llvm-svn: 340679
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/LiveDebugVariables.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp index 3ff03ec4a7e..b258a0e8300 100644 --- a/llvm/lib/CodeGen/LiveDebugVariables.cpp +++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp @@ -752,7 +752,15 @@ void UserValue::computeIntervals(MachineRegisterInfo &MRI, } SmallVector<SlotIndex, 16> Kills; extendDef(Idx, Loc, LI, VNI, &Kills, LIS); - if (LI) + // FIXME: Handle sub-registers in addDefsFromCopies. The problem is that + // if the original location for example is %vreg0:sub_hi, and we find a + // full register copy in addDefsFromCopies (at the moment it only handles + // full register copies), then we must add the sub1 sub-register index to + // the new location. However, that is only possible if the new virtual + // register is of the same regclass (or if there is an equivalent + // sub-register in that regclass). For now, simply skip handling copies if + // a sub-register is involved. + if (LI && !LocMO.getSubReg()) addDefsFromCopies(LI, Loc.locNo(), Loc.wasIndirect(), Kills, Defs, MRI, LIS); continue; |