summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2015-01-25 19:04:08 +0000
committerAdrian Prantl <aprantl@apple.com>2015-01-25 19:04:08 +0000
commit40cb819c6f23cf58416798e3f39136b39a33f8e6 (patch)
tree45057d91dd65c0f2aa947f76d4243509be7ced11 /llvm/lib/CodeGen
parent258ac3cc56a70ec9629aa9f2c38d75e9d97ec447 (diff)
downloadbcm5719-llvm-40cb819c6f23cf58416798e3f39136b39a33f8e6.tar.gz
bcm5719-llvm-40cb819c6f23cf58416798e3f39136b39a33f8e6.zip
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. llvm-svn: 227056
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp11
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp3
2 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 155cd4c0191..7e147e8466a 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -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.
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
index f3d3fb45bb2..7c5c879289b 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
@@ -92,6 +92,9 @@ bool DwarfExpression::AddMachineRegPiece(unsigned MachineReg,
unsigned PieceSizeInBits,
unsigned PieceOffsetInBits) {
const TargetRegisterInfo *TRI = getTRI();
+ if (!TRI->isPhysicalRegister(MachineReg))
+ return false;
+
int Reg = TRI->getDwarfRegNum(MachineReg, false);
// If this is a valid register number, emit it.
OpenPOWER on IntegriCloud