aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-09-09 22:35:03 +0000
committerChris Lattner <sabre@nondot.org>2005-09-09 22:35:03 +0000
commit08addbd4770a60adb6dbdc29cf73e7720f08197a (patch)
tree0414e79a8c67cef2482f338a8f9e6e9d6e5c789d /lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parentc9fe7508a5e072479d4ab5711c60aa5142c64f10 (diff)
Fix a crash viewing dags that have target nodes in them
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23300 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index ae0c2c8d71..c27523ae13 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -2263,7 +2263,8 @@ const char *SDNode::getOperationName(const SelectionDAG *G) const {
else {
if (G)
if (const TargetInstrInfo *TII = G->getTarget().getInstrInfo())
- return TII->getName(getOpcode()-ISD::BUILTIN_OP_END);
+ if (getOpcode()-ISD::BUILTIN_OP_END < TII->getNumOpcodes())
+ return TII->getName(getOpcode()-ISD::BUILTIN_OP_END);
return "<<Unknown Target Node>>";
}