From b4fdc9252db3bf19f1ff39d789b1198ce10fcaaa Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Wed, 30 Sep 2009 20:35:36 +0000 Subject: [PATCH] Add additional assert() to verify no extraneous use of a scavenged register. llvm-svn: 83163 --- lib/CodeGen/PrologEpilogInserter.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp index 9ec54b5a1c5..51c78a18d7b 100644 --- a/lib/CodeGen/PrologEpilogInserter.cpp +++ b/lib/CodeGen/PrologEpilogInserter.cpp @@ -744,8 +744,15 @@ void PEI::scavengeFrameVirtualRegs(MachineFunction &Fn) { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) if (MI->getOperand(i).isReg()) { unsigned Reg = MI->getOperand(i).getReg(); - if (Reg == 0 || !TargetRegisterInfo::isVirtualRegister(Reg)) + if (Reg == 0) continue; + if (!TargetRegisterInfo::isVirtualRegister(Reg)) { + // If we have an active scavenged register, we shouldn't be + // seeing any references to it. + assert (Reg != CurrentScratchReg + && "overlapping use of scavenged frame index register!"); + continue; + } // If we already have a scratch for this virtual register, use it if (Reg != CurrentVirtReg) { @@ -770,7 +777,7 @@ void PEI::scavengeFrameVirtualRegs(MachineFunction &Fn) { // If this is the last use of the register, stop tracking it. if (MI->getOperand(i).isKill()) - CurrentVirtReg = 0; + CurrentScratchReg = CurrentVirtReg = 0; } RS->forward(MI); }