diff options
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 71fdb0f90f2..3e040711052 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -1379,7 +1379,12 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI, const_iterator I(Before); // If this is the last insn in the block, don't search forwards. if (I != end()) { - for (++I; I != end() && N > 0; ++I, --N) { + for (++I; I != end() && N > 0; ++I) { + if (I->isDebugInstr()) + continue; + + --N; + MachineOperandIteratorBase::PhysRegInfo Info = ConstMIOperands(*I).analyzePhysReg(Reg, TRI); @@ -1416,6 +1421,11 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI, do { --I; + if (I->isDebugInstr()) + continue; + + --N; + MachineOperandIteratorBase::PhysRegInfo Info = ConstMIOperands(*I).analyzePhysReg(Reg, TRI); @@ -1440,7 +1450,8 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI, // Register must be live if we read it. if (Info.Read) return LQR_Live; - } while (I != begin() && --N > 0); + + } while (I != begin() && N > 0); } // Did we get to the start of the block? @@ -1454,7 +1465,6 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI, return LQR_Dead; } - // At this point we have no idea of the liveness of the register. return LQR_Unknown; } |