Fix a crash viewing dags that have target nodes in them
authorChris Lattner <sabre@nondot.org>
Fri, 9 Sep 2005 22:35:03 +0000 (22:35 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 9 Sep 2005 22:35:03 +0000 (22:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23300 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index ae0c2c8d7122729794f4cb759b3b25ca8f3031b9..c27523ae13133d3ec09325f872f5df0ae1ee2428 100644 (file)
@@ -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>>";
     }