diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 4ecea2f42b2..a89660bb4b4 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -2078,7 +2078,7 @@ void SDNode::dump(const SelectionDAG *G) const { std::cerr << LBB->getName() << " "; std::cerr << (const void*)BBDN->getBasicBlock() << ">"; } else if (const RegisterSDNode *R = dyn_cast(this)) { - if (G && MRegisterInfo::isPhysicalRegister(R->getReg())) { + if (G && R->getReg() && MRegisterInfo::isPhysicalRegister(R->getReg())) { std::cerr << " " <getTarget().getRegisterInfo()->getName(R->getReg()); } else { std::cerr << " #" << R->getReg();