aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineOperand.cpp
diff options
context:
space:
mode:
authorJonas Paulsson <paulsson@linux.vnet.ibm.com>2018-10-25 23:39:07 +0000
committerJonas Paulsson <paulsson@linux.vnet.ibm.com>2018-10-25 23:39:07 +0000
commitf213f81d9ca40d3a7a154a6914a659806a67293c (patch)
treedb17fbae99eb087c718dd6cf89e51be70858dab6 /llvm/lib/CodeGen/MachineOperand.cpp
parentff6df778c6b8d3d1ec1eb0a300adbfb93c3f8757 (diff)
downloadllvm-f213f81d9ca40d3a7a154a6914a659806a67293c.zip
llvm-f213f81d9ca40d3a7a154a6914a659806a67293c.tar.gz
llvm-f213f81d9ca40d3a7a154a6914a659806a67293c.tar.bz2
Fix in MachineOperand::printIRValueReference().
Handle the case where getCurrentFunction() returns nullptr by passing -1 to printIRSlotNumber(). This will result in <badref> being printed instead of an assertion failure. Review: Francis Visoiu Mistrih https://reviews.llvm.org/D53333 llvm-svn: 345342
Diffstat (limited to 'llvm/lib/CodeGen/MachineOperand.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineOperand.cpp3
1 files changed, 2 insertions, 1 deletions
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,