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
This commit is contained in:
Chris Lattner 2005-09-09 22:35:03 +00:00
parent c9fe7508a5
commit 08addbd477

View 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>>";
}