summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocGreedy.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-08-05 22:20:45 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-08-05 22:20:45 +0000
commit2d6d86be84ee355223ccd20b7f87a0c9971c50c9 (patch)
tree444ace3252917e51cfbe061f6d7f2699ebdf65a6 /lib/CodeGen/RegAllocGreedy.cpp
parent0d6fac36eda6b65f0e396b24c5bce582f89f7992 (diff)
downloadllvm-2d6d86be84ee355223ccd20b7f87a0c9971c50c9.tar.gz
llvm-2d6d86be84ee355223ccd20b7f87a0c9971c50c9.tar.bz2
llvm-2d6d86be84ee355223ccd20b7f87a0c9971c50c9.tar.xz
Split around single instructions to enable register class inflation.
Normally, we don't create a live range for a single instruction in a basic block, the spiller does that anyway. However, when splitting a live range that belongs to a proper register sub-class, inserting these extra COPY instructions completely remove the constraints from the remainder interval, and it may be allocated from the larger super-class. The spiller will mop up these small live ranges if we end up spilling anyway. It calls them snippets. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136989 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocGreedy.cpp')
-rw-r--r--lib/CodeGen/RegAllocGreedy.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/CodeGen/RegAllocGreedy.cpp b/lib/CodeGen/RegAllocGreedy.cpp
index 87b12c687e..90d3810437 100644
--- a/lib/CodeGen/RegAllocGreedy.cpp
+++ b/lib/CodeGen/RegAllocGreedy.cpp
@@ -942,6 +942,12 @@ void RAGreedy::splitAroundRegion(LiveRangeEdit &LREdit,
DEBUG(dbgs() << "splitAroundRegion with " << NumGlobalIntvs << " globals.\n");
assert(NumGlobalIntvs && "No global intervals configured");
+ // Isolate even single instructions when dealing with a proper sub-class.
+ // That giarantees register class inflation for the stack interval because it
+ // is all copies.
+ unsigned Reg = SA->getParent().reg;
+ bool SingleInstrs = RegClassInfo.isProperSubClass(MRI->getRegClass(Reg));
+
// First handle all the blocks with uses.
ArrayRef<SplitAnalysis::BlockInfo> UseBlocks = SA->getUseBlocks();
for (unsigned i = 0; i != UseBlocks.size(); ++i) {
@@ -971,7 +977,7 @@ void RAGreedy::splitAroundRegion(LiveRangeEdit &LREdit,
// Create separate intervals for isolated blocks with multiple uses.
if (!IntvIn && !IntvOut) {
DEBUG(dbgs() << "BB#" << BI.MBB->getNumber() << " isolated.\n");
- if (!BI.isOneInstr())
+ if (SA->shouldSplitSingleBlock(BI, SingleInstrs))
SE->splitSingleBlock(BI);
continue;
}