Debug info: Fix PR22296 by omitting the DW_AT_location if we lost the
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfExpression.cpp
index f3d3fb45bb2a99b98d22340e3bd0b292c0b53195..7c5c879289be7619c01f5e686a288c7bb1825f69 100644 (file)
@@ -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.