summaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineLICM.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2010-07-20 00:50:13 +0000
committerDale Johannesen <dalej@apple.com>2010-07-20 00:50:13 +0000
commitbf1ae5e254f8f6f6f3dfe9438d14bef9b955f01f (patch)
treee13d8954f65191d5d1ef6ef416fe0a20e511e98a /lib/CodeGen/MachineLICM.cpp
parent7a2b701ef6a294170fb92a535d52bc533778acff (diff)
downloadllvm-bf1ae5e254f8f6f6f3dfe9438d14bef9b955f01f.tar.gz
llvm-bf1ae5e254f8f6f6f3dfe9438d14bef9b955f01f.tar.bz2
llvm-bf1ae5e254f8f6f6f3dfe9438d14bef9b955f01f.tar.xz
Don't hoist things out of a large switch inside a
loop, for the reasons in the comments. This is a major win on 253.perlbmk on ARM Darwin. I expect it to be a good heuristic in general, but it's possible some things will regress; I'll be watching. 7940152. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108792 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineLICM.cpp')
-rw-r--r--lib/CodeGen/MachineLICM.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/MachineLICM.cpp b/lib/CodeGen/MachineLICM.cpp
index 4c054f51f3..83f66ce094 100644
--- a/lib/CodeGen/MachineLICM.cpp
+++ b/lib/CodeGen/MachineLICM.cpp
@@ -489,8 +489,12 @@ void MachineLICM::HoistRegion(MachineDomTreeNode *N) {
}
const std::vector<MachineDomTreeNode*> &Children = N->getChildren();
- for (unsigned I = 0, E = Children.size(); I != E; ++I)
- HoistRegion(Children[I]);
+ // Don't hoist things out of a large switch statement. This often causes
+ // code to be hoisted that wasn't going to be executed, and increases
+ // register pressure in a situation where it's likely to matter.
+ if (Children.size() < 10)
+ for (unsigned I = 0, E = Children.size(); I != E; ++I)
+ HoistRegion(Children[I]);
}
/// IsLICMCandidate - Returns true if the instruction may be a suitable