aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineOperand.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/MachineOperand.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineOperand.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineOperand.cpp b/llvm/lib/CodeGen/MachineOperand.cpp
index d9e5e9d..18027b2 100644
--- a/llvm/lib/CodeGen/MachineOperand.cpp
+++ b/llvm/lib/CodeGen/MachineOperand.cpp
@@ -909,7 +909,11 @@ void MachineOperand::print(raw_ostream &OS, ModuleSlotTracker &MST,
OS << printJumpTableEntryReference(getIndex());
break;
case MachineOperand::MO_GlobalAddress:
- getGlobal()->printAsOperand(OS, /*PrintType=*/false, MST);
+ if (const auto *GV = getGlobal())
+ getGlobal()->printAsOperand(OS, /*PrintType=*/false, MST);
+ else // Invalid, but may appear in debugging scenarios.
+ OS << "globaladdress(null)";
+
printOperandOffset(OS, getOffset());
break;
case MachineOperand::MO_ExternalSymbol: {