diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2024-12-03 19:15:56 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-03 19:15:56 -0500 |
commit | e9dc6c5fbb6d2c2c93095acb6ff4ca0b515057ed (patch) | |
tree | 32f927d9b4b9999276b5b736d206fd7955780156 /llvm/lib/CodeGen/MachineOperand.cpp | |
parent | a201ba1b57aa57df8e31603b496793fa39d31936 (diff) | |
download | llvm-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.cpp | 6 |
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: { |