Debug info: Fix PR22296 by omitting the DW_AT_location if we lost the

physical register that is described in a DBG_VALUE.

In the testcase the DBG_VALUE describing "p5" becomes unavailable
because the register its address is in is clobbered and we (currently)
aren't smart enough to realize that the value is rematerialized immediately
after the DBG_VALUE and/or is actually a stack slot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227056 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adrian Prantl
2015-01-25 19:04:08 +00:00
parent 9dbb6a4f63
commit 10543e8587
3 changed files with 383 additions and 4 deletions

View File

@ -768,15 +768,18 @@ void DwarfCompileUnit::addComplexAddress(const DbgVariable &DV, DIE &Die,
DIELoc *Loc = new (DIEValueAllocator) DIELoc();
DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
DIExpression Expr = DV.getExpression();
bool ValidReg;
if (Location.getOffset()) {
if (DwarfExpr.AddMachineRegIndirect(Location.getReg(),
Location.getOffset()))
ValidReg = DwarfExpr.AddMachineRegIndirect(Location.getReg(),
Location.getOffset());
if (ValidReg)
DwarfExpr.AddExpression(Expr);
} else
DwarfExpr.AddMachineRegExpression(Expr, Location.getReg());
ValidReg = DwarfExpr.AddMachineRegExpression(Expr, Location.getReg());
// Now attach the location information to the DIE.
addBlock(Die, Attribute, Loc);
if (ValidReg)
addBlock(Die, Attribute, Loc);
}
/// Add a Dwarf loclistptr attribute data and value.