From 5fbc87021e15f0a4044ecdd5ce5ff0d9a7f83c4a Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Mon, 24 Jul 2017 18:07:55 +0000 Subject: [PATCH] RA: Replace asserts related to empty live intervals These don't exactly assert the same thing anymore, and allow empty live intervals with non-empty uses. Removed in r308808 and r308813. llvm-svn: 308906 --- llvm/lib/CodeGen/InlineSpiller.cpp | 5 ++++- llvm/lib/CodeGen/RegAllocBase.cpp | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/llvm/lib/CodeGen/InlineSpiller.cpp b/llvm/lib/CodeGen/InlineSpiller.cpp index 407fd2477a67..eda4f74c7874 100644 --- a/llvm/lib/CodeGen/InlineSpiller.cpp +++ b/llvm/lib/CodeGen/InlineSpiller.cpp @@ -644,7 +644,10 @@ void InlineSpiller::reMaterializeAll() { continue; } - assert(LIS.hasInterval(Reg) && "Reg with no interval"); + assert(LIS.hasInterval(Reg) && + (!LIS.getInterval(Reg).empty() || !MRI.reg_nodbg_empty(Reg)) && + "Empty and not used live-range?!"); + RegsToSpill[ResultPos++] = Reg; } RegsToSpill.erase(RegsToSpill.begin() + ResultPos, RegsToSpill.end()); diff --git a/llvm/lib/CodeGen/RegAllocBase.cpp b/llvm/lib/CodeGen/RegAllocBase.cpp index 5a80bd95d6e4..7b4fbace2c1c 100644 --- a/llvm/lib/CodeGen/RegAllocBase.cpp +++ b/llvm/lib/CodeGen/RegAllocBase.cpp @@ -133,11 +133,13 @@ void RegAllocBase::allocatePhysRegs() { if (AvailablePhysReg) Matrix->assign(*VirtReg, AvailablePhysReg); - for (VirtRegVec::iterator I = SplitVRegs.begin(), E = SplitVRegs.end(); - I != E; ++I) { - LiveInterval *SplitVirtReg = &LIS->getInterval(*I); + for (unsigned Reg : SplitVRegs) { + assert(LIS->hasInterval(Reg)); + + LiveInterval *SplitVirtReg = &LIS->getInterval(Reg); assert(!VRM->hasPhys(SplitVirtReg->reg) && "Register already assigned"); if (MRI->reg_nodbg_empty(SplitVirtReg->reg)) { + assert(SplitVirtReg->empty() && "Non-empty but used interval"); DEBUG(dbgs() << "not queueing unused " << *SplitVirtReg << '\n'); aboutToRemoveInterval(*SplitVirtReg); LIS->removeInterval(SplitVirtReg->reg);