From 32030fe021ee614df6fdd77a2228e0e265049f3d 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83163 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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); } -- 2.34.1