From f213f81d9ca40d3a7a154a6914a659806a67293c Mon Sep 17 00:00:00 2001 From: Jonas Paulsson Date: Thu, 25 Oct 2018 23:39:07 +0000 Subject: Fix in MachineOperand::printIRValueReference(). Handle the case where getCurrentFunction() returns nullptr by passing -1 to printIRSlotNumber(). This will result in being printed instead of an assertion failure. Review: Francis Visoiu Mistrih https://reviews.llvm.org/D53333 llvm-svn: 345342 --- llvm/lib/CodeGen/MachineOperand.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/MachineOperand.cpp') diff --git a/llvm/lib/CodeGen/MachineOperand.cpp b/llvm/lib/CodeGen/MachineOperand.cpp index a116d8f..97d32a5 100644 --- a/llvm/lib/CodeGen/MachineOperand.cpp +++ b/llvm/lib/CodeGen/MachineOperand.cpp @@ -461,7 +461,8 @@ static void printIRValueReference(raw_ostream &OS, const Value &V, printLLVMNameWithoutPrefix(OS, V.getName()); return; } - MachineOperand::printIRSlotNumber(OS, MST.getLocalSlot(&V)); + int Slot = MST.getCurrentFunction() ? MST.getLocalSlot(&V) : -1; + MachineOperand::printIRSlotNumber(OS, Slot); } static void printSyncScope(raw_ostream &OS, const LLVMContext &Context, -- cgit v1.1