aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-10-14 18:26:45 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-10-14 18:26:45 +0000
commitab00e9f498a23a511a06d9fcd33e7232e9a3f916 (patch)
tree709cbdf8d6a0cda51ea9230739ab8080245b0fc3 /lib/CodeGen
parentc934a67ef66c6ab25f05271ff7227ed75e7c8320 (diff)
downloadexternal_llvm-ab00e9f498a23a511a06d9fcd33e7232e9a3f916.zip
external_llvm-ab00e9f498a23a511a06d9fcd33e7232e9a3f916.tar.gz
external_llvm-ab00e9f498a23a511a06d9fcd33e7232e9a3f916.tar.bz2
Only split around a loop if the live range has uses outside the loop periphery.
Before we would also split around a loop if any peripheral block had multiple uses. This could cause repeated splitting when splitting a different live range would insert uses into the periphery. Now -spiller=inline passes the nightly test suite again. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116494 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SplitKit.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/lib/CodeGen/SplitKit.cpp b/lib/CodeGen/SplitKit.cpp
index 30f9600..2ab7fa8 100644
--- a/lib/CodeGen/SplitKit.cpp
+++ b/lib/CodeGen/SplitKit.cpp
@@ -213,24 +213,28 @@ const MachineLoop *SplitAnalysis::getBestSplitLoop() {
if (usingLoops_.empty())
return 0;
- LoopPtrSet Loops, SecondLoops;
+ LoopPtrSet Loops;
LoopBlocks Blocks;
BlockPtrSet CriticalExits;
- // Find first-class and second class candidate loops.
- // We prefer to split around loops where curli is used outside the periphery.
+ // We split around loops where curli is used outside the periphery.
for (LoopCountMap::const_iterator I = usingLoops_.begin(),
E = usingLoops_.end(); I != E; ++I) {
const MachineLoop *Loop = I->first;
getLoopBlocks(Loop, Blocks);
- LoopPtrSet *LPS = 0;
switch(analyzeLoopPeripheralUse(Blocks)) {
case OutsideLoop:
- LPS = &Loops;
break;
case MultiPeripheral:
- LPS = &SecondLoops;
+ // FIXME: We could split a live range with multiple uses in a peripheral
+ // block and still make progress. However, it is possible that splitting
+ // another live range will insert copies into a peripheral block, and
+ // there is a small chance we can enter an infinity loop, inserting copies
+ // forever.
+ // For safety, stick to splitting live ranges with uses outside the
+ // periphery.
+ DEBUG(dbgs() << " multiple peripheral uses in " << *Loop);
break;
case ContainedInLoop:
DEBUG(dbgs() << " contained in " << *Loop);
@@ -246,16 +250,11 @@ const MachineLoop *SplitAnalysis::getBestSplitLoop() {
if (!canSplitCriticalExits(Blocks, CriticalExits))
continue;
// This is a possible split.
- assert(LPS);
- LPS->insert(Loop);
+ Loops.insert(Loop);
}
- DEBUG(dbgs() << " getBestSplitLoop found " << Loops.size() << " + "
- << SecondLoops.size() << " candidate loops.\n");
-
- // If there are no first class loops available, look at second class loops.
- if (Loops.empty())
- Loops = SecondLoops;
+ DEBUG(dbgs() << " getBestSplitLoop found " << Loops.size()
+ << " candidate loops.\n");
if (Loops.empty())
return 0;