Index: llvm/lib/CodeGen/RegAllocGreedy.cpp =================================================================== --- llvm/lib/CodeGen/RegAllocGreedy.cpp +++ llvm/lib/CodeGen/RegAllocGreedy.cpp @@ -2504,17 +2504,6 @@ SA->analyze(&VirtReg); - // FIXME: SplitAnalysis may repair broken live ranges coming from the - // coalescer. That may cause the range to become allocatable which means that - // tryRegionSplit won't be making progress. This check should be replaced with - // an assertion when the coalescer is fixed. - if (SA->didRepairRange()) { - // VirtReg has changed, so all cached queries are invalid. - Matrix->invalidateVirtRegs(); - if (Register PhysReg = tryAssign(VirtReg, Order, NewVRegs, FixedRegisters)) - return PhysReg; - } - // First try to split around a region spanning multiple blocks. RS_Split2 // ranges already made dubious progress with region splitting, so they go // straight to single block splitting. Index: llvm/lib/CodeGen/SplitKit.h =================================================================== --- llvm/lib/CodeGen/SplitKit.h +++ llvm/lib/CodeGen/SplitKit.h @@ -160,14 +160,11 @@ /// NumThroughBlocks - Number of live-through blocks. unsigned NumThroughBlocks; - /// DidRepairRange - analyze was forced to shrinkToUses(). - bool DidRepairRange; - // Sumarize statistics by counting instructions using CurLI. void analyzeUses(); /// calcLiveBlockInfo - Compute per-block information about CurLI. - bool calcLiveBlockInfo(); + void calcLiveBlockInfo(); public: SplitAnalysis(const VirtRegMap &vrm, const LiveIntervals &lis, @@ -177,11 +174,6 @@ /// split. void analyze(const LiveInterval *li); - /// didRepairRange() - Returns true if CurLI was invalid and has been repaired - /// by analyze(). This really shouldn't happen, but sometimes the coalescer - /// can create live ranges that end in mid-air. - bool didRepairRange() const { return DidRepairRange; } - /// clear - clear all data structures so SplitAnalysis is ready to analyze a /// new interval. void clear(); Index: llvm/lib/CodeGen/SplitKit.cpp =================================================================== --- llvm/lib/CodeGen/SplitKit.cpp +++ llvm/lib/CodeGen/SplitKit.cpp @@ -50,7 +50,6 @@ STATISTIC(NumSimple, "Number of splits that were simple"); STATISTIC(NumCopies, "Number of copies inserted for splitting"); STATISTIC(NumRemats, "Number of rematerialized defs for splitting"); -STATISTIC(NumRepairs, "Number of invalid live ranges repaired"); //===----------------------------------------------------------------------===// // Last Insert Point Analysis @@ -160,7 +159,6 @@ UseBlocks.clear(); ThroughBlocks.clear(); CurLI = nullptr; - DidRepairRange = false; } /// analyzeUses - Count instructions, basic blocks, and loops using CurLI. @@ -188,20 +186,7 @@ UseSlots.end()); // Compute per-live block info. - if (!calcLiveBlockInfo()) { - // FIXME: calcLiveBlockInfo found inconsistencies in the live range. - // I am looking at you, RegisterCoalescer! - DidRepairRange = true; - ++NumRepairs; - LLVM_DEBUG(dbgs() << "*** Fixing inconsistent live interval! ***\n"); - const_cast(LIS) - .shrinkToUses(const_cast(CurLI)); - UseBlocks.clear(); - ThroughBlocks.clear(); - bool fixed = calcLiveBlockInfo(); - (void)fixed; - assert(fixed && "Couldn't fix broken live interval"); - } + calcLiveBlockInfo(); LLVM_DEBUG(dbgs() << "Analyze counted " << UseSlots.size() << " instrs in " << UseBlocks.size() << " blocks, through " @@ -210,11 +195,11 @@ /// calcLiveBlockInfo - Fill the LiveBlocks array with information about blocks /// where CurLI is live. -bool SplitAnalysis::calcLiveBlockInfo() { +void SplitAnalysis::calcLiveBlockInfo() { ThroughBlocks.resize(MF.getNumBlockIDs()); NumThroughBlocks = NumGapBlocks = 0; if (CurLI->empty()) - return true; + return; LiveInterval::const_iterator LVI = CurLI->begin(); LiveInterval::const_iterator LVE = CurLI->end(); @@ -240,8 +225,7 @@ ThroughBlocks.set(BI.MBB->getNumber()); // The range shouldn't end mid-block if there are no uses. This shouldn't // happen. - if (LVI->end < Stop) - return false; + assert(LVI->end >= Stop && "range ends mid block with no uses"); } else { // This block has uses. Find the first and last uses in the block. BI.FirstInstr = *UseI; @@ -312,7 +296,6 @@ } assert(getNumLiveBlocks() == countLiveBlocks(CurLI) && "Bad block count"); - return true; } unsigned SplitAnalysis::countLiveBlocks(const LiveInterval *cli) const {