aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index a930948..0c4353f 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -1883,16 +1883,20 @@ void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST,
DL.print(OS);
}
- // Print extra comments for DEBUG_VALUE.
- if (isDebugValueLike() && getDebugVariableOp().isMetadata()) {
- if (!HaveSemi) {
- OS << ";";
- HaveSemi = true;
+ // Print extra comments for DEBUG_VALUE and friends if they are well-formed.
+ if ((isNonListDebugValue() && getNumOperands() >= 4) ||
+ (isDebugValueList() && getNumOperands() >= 2) ||
+ (isDebugRef() && getNumOperands() >= 3)) {
+ if (getDebugVariableOp().isMetadata()) {
+ if (!HaveSemi) {
+ OS << ";";
+ HaveSemi = true;
+ }
+ auto *DV = getDebugVariable();
+ OS << " line no:" << DV->getLine();
+ if (isIndirectDebugValue())
+ OS << " indirect";
}
- auto *DV = getDebugVariable();
- OS << " line no:" << DV->getLine();
- if (isIndirectDebugValue())
- OS << " indirect";
}
// TODO: DBG_LABEL