From: Quentin Colombet Date: Mon, 21 Aug 2017 22:56:18 +0000 (+0000) Subject: [RegAlloc] Make sure live-ranges reflect the state of the IR when removing them X-Git-Tag: android-x86-7.1-r4~11942 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=463fa38;p=android-x86%2Fexternal-llvm.git [RegAlloc] Make sure live-ranges reflect the state of the IR when removing them When removing a live-range we used to not touch them making debug prints harder to read because the IR was not matching what the live-ranges information was saying. This only affects debug printing and allows to put stronger asserts in the code (see r308906 for instance). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311401 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/RegAllocBasic.cpp b/lib/CodeGen/RegAllocBasic.cpp index 774306154a8..5ecde0c9d9f 100644 --- a/lib/CodeGen/RegAllocBasic.cpp +++ b/lib/CodeGen/RegAllocBasic.cpp @@ -143,14 +143,17 @@ INITIALIZE_PASS_END(RABasic, "regallocbasic", "Basic Register Allocator", false, false) bool RABasic::LRE_CanEraseVirtReg(unsigned VirtReg) { + LiveInterval &LI = LIS->getInterval(VirtReg); if (VRM->hasPhys(VirtReg)) { - LiveInterval &LI = LIS->getInterval(VirtReg); Matrix->unassign(LI); aboutToRemoveInterval(LI); return true; } // Unassigned virtreg is probably in the priority queue. // RegAllocBase will erase it after dequeueing. + // Nonetheless, clear the live-range so that the debug + // dump will show the right state for that VirtReg. + LI.clear(); return false; } diff --git a/lib/CodeGen/RegAllocGreedy.cpp b/lib/CodeGen/RegAllocGreedy.cpp index 020e81eca2d..6f0b7a936c5 100644 --- a/lib/CodeGen/RegAllocGreedy.cpp +++ b/lib/CodeGen/RegAllocGreedy.cpp @@ -546,14 +546,17 @@ void RAGreedy::getAnalysisUsage(AnalysisUsage &AU) const { //===----------------------------------------------------------------------===// bool RAGreedy::LRE_CanEraseVirtReg(unsigned VirtReg) { + LiveInterval &LI = LIS->getInterval(VirtReg); if (VRM->hasPhys(VirtReg)) { - LiveInterval &LI = LIS->getInterval(VirtReg); Matrix->unassign(LI); aboutToRemoveInterval(LI); return true; } // Unassigned virtreg is probably in the priority queue. // RegAllocBase will erase it after dequeueing. + // Nonetheless, clear the live-range so that the debug + // dump will show the right state for that VirtReg. + LI.clear(); return false; }