[llvm-commits] [llvm] r108792 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp

Dale Johannesen dalej at apple.com
Mon Jul 19 17:50:13 PDT 2010


Author: johannes
Date: Mon Jul 19 19:50:13 2010
New Revision: 108792

URL: http://llvm.org/viewvc/llvm-project?rev=108792&view=rev
Log:
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.


Modified:
    llvm/trunk/lib/CodeGen/MachineLICM.cpp

Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=108792&r1=108791&r2=108792&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Mon Jul 19 19:50:13 2010
@@ -489,8 +489,12 @@
   }
 
   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





More information about the llvm-commits mailing list