aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineOperand.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2024-12-03 19:15:56 -0500
committerGitHub <noreply@github.com>2024-12-03 19:15:56 -0500
commite9dc6c5fbb6d2c2c93095acb6ff4ca0b515057ed (patch)
tree32f927d9b4b9999276b5b736d206fd7955780156 /llvm/lib/CodeGen/MachineOperand.cpp
parenta201ba1b57aa57df8e31603b496793fa39d31936 (diff)
downloadllvm-e9dc6c5fbb6d2c2c93095acb6ff4ca0b515057ed.zip
llvm-e9dc6c5fbb6d2c2c93095acb6ff4ca0b515057ed.tar.gz
llvm-e9dc6c5fbb6d2c2c93095acb6ff4ca0b515057ed.tar.bz2
CodeGen: Don't assert when printing null GlobalAddress operands (#115531)
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: {