From 96f3fd9a7fa709bc1ae738f6f6f82b73d4a93628 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Wed, 29 Apr 2009 07:16:34 +0000 Subject: spillPhysRegAroundRegDefsUses() may have invalidated iterators stored in fixed_ IntervalPtrs. Reset them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70378 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/RegAllocLinearScan.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/CodeGen/RegAllocLinearScan.cpp') diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp index 2ed902c..17aec81 100644 --- a/lib/CodeGen/RegAllocLinearScan.cpp +++ b/lib/CodeGen/RegAllocLinearScan.cpp @@ -978,6 +978,15 @@ void RALinScan::assignRegOrStackSlotAtInterval(LiveInterval* cur) li_->getApproximateInstructionCount(*cur) == 0) { // Spill a physical register around defs and uses. if (li_->spillPhysRegAroundRegDefsUses(*cur, minReg, *vrm_)) { + // spillPhysRegAroundRegDefsUses may have invalidated iterator stored + // in fixed_. Reset them. + for (unsigned i = 0, e = fixed_.size(); i != e; ++i) { + IntervalPtr &IP = fixed_[i]; + LiveInterval *I = IP.first; + if (I->reg == minReg || tri_->isSubRegister(minReg, I->reg)) + IP.second = I->advanceTo(I->begin(), StartPosition); + } + DowngradedRegs.clear(); assignRegOrStackSlotAtInterval(cur); } else { -- cgit v1.1