Fix crash caused by passing register 0 to
authorAlkis Evlogimenos <alkis@evlogimenos.com>
Fri, 27 Feb 2004 01:52:34 +0000 (01:52 +0000)
committerAlkis Evlogimenos <alkis@evlogimenos.com>
Fri, 27 Feb 2004 01:52:34 +0000 (01:52 +0000)
MRegisterInfo::isPhysicalRegister().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11894 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineInstr.cpp

index 030cb7ef0cf162510be7e66f2fb72f84474ce8e6..1e77988be5de3c99f670c715368cb2ac26bf1d73 100644 (file)
@@ -199,7 +199,7 @@ static inline std::ostream& OutputValue(std::ostream &os, const Value* val) {
 
 static inline void OutputReg(std::ostream &os, unsigned RegNo,
                              const MRegisterInfo *MRI = 0) {
-  if (MRegisterInfo::isPhysicalRegister(RegNo)) {
+  if (!RegNo || MRegisterInfo::isPhysicalRegister(RegNo)) {
     if (MRI)
       os << "%" << MRI->get(RegNo).Name;
     else