diff options
| author | Adrian Prantl <aprantl@apple.com> | 2016-11-02 16:12:16 +0000 |
|---|---|---|
| committer | Adrian Prantl <aprantl@apple.com> | 2016-11-02 16:12:16 +0000 |
| commit | 56527dc804d2f6adc97d17a81e02d749c38ef3fe (patch) | |
| tree | 67286dc5b36a406b4107beae2d591c0bbcad5c78 /llvm/lib/CodeGen/AsmPrinter | |
| parent | 4eec18ffc931a6ce744ab3f35ceed8675d9b8521 (diff) | |
| download | bcm5719-llvm-56527dc804d2f6adc97d17a81e02d749c38ef3fe.tar.gz bcm5719-llvm-56527dc804d2f6adc97d17a81e02d749c38ef3fe.zip | |
Emit DW_OP_piece also if the previous value was a constant.
This fixes a bug in the DWARF backend.
llvm-svn: 285826
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index d4cc3f199bf..d98524b66cc 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1406,6 +1406,7 @@ static void emitDebugLocValue(const AsmPrinter &AP, const DIBasicType *BT, ByteStreamer &Streamer, const DebugLocEntry::Value &Value, unsigned PieceOffsetInBits) { + const DIExpression *Expr = Value.getExpression(); DebugLocDwarfExpression DwarfExpr(AP.getDwarfDebug()->getDwarfVersion(), Streamer); // Regular entry. @@ -1417,7 +1418,6 @@ static void emitDebugLocValue(const AsmPrinter &AP, const DIBasicType *BT, DwarfExpr.AddUnsignedConstant(Value.getInt()); } else if (Value.isLocation()) { MachineLocation Loc = Value.getLoc(); - const DIExpression *Expr = Value.getExpression(); if (!Expr || !Expr->getNumElements()) // Regular entry. AP.EmitDwarfRegOp(Streamer, Loc); @@ -1426,16 +1426,18 @@ static void emitDebugLocValue(const AsmPrinter &AP, const DIBasicType *BT, const TargetRegisterInfo &TRI = *AP.MF->getSubtarget().getRegisterInfo(); if (Loc.getOffset()) { DwarfExpr.AddMachineRegIndirect(TRI, Loc.getReg(), Loc.getOffset()); - DwarfExpr.AddExpression(Expr->expr_op_begin(), Expr->expr_op_end(), - PieceOffsetInBits); - } else + } else { DwarfExpr.AddMachineRegExpression(TRI, Expr, Loc.getReg(), PieceOffsetInBits); + return; + } } } else if (Value.isConstantFP()) { APInt RawBytes = Value.getConstantFP()->getValueAPF().bitcastToAPInt(); DwarfExpr.AddUnsignedConstant(RawBytes); } + DwarfExpr.AddExpression(Expr->expr_op_begin(), Expr->expr_op_end(), + PieceOffsetInBits); } void DebugLocEntry::finalize(const AsmPrinter &AP, |

