summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-06-28 16:38:55 +0000
committerChris Lattner <sabre@nondot.org>2006-06-28 16:38:55 +0000
commit0a2e11260e6b347bcd90b0c4b192482fe1c2aa6e (patch)
treebbceb56f016d15c7ddaf052cad9dc618401157f1 /llvm/lib
parent0687b04455b0b559ec972ced988aac0dbbd30978 (diff)
downloadbcm5719-llvm-0a2e11260e6b347bcd90b0c4b192482fe1c2aa6e.tar.gz
bcm5719-llvm-0a2e11260e6b347bcd90b0c4b192482fe1c2aa6e.zip
Don't unswitch really large loops even if they are mostly filled with empty
blocks. llvm-svn: 28959
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnswitch.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
index d33dcb7c0b0..945803f0afc 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -333,6 +333,12 @@ unsigned LoopUnswitch::getLoopUnswitchCost(Loop *L, Value *LIC) {
if (IsTrivialUnswitchCondition(L, LIC))
return 0;
+ // If the loop is really large (over twice our threshold) don't even consider
+ // unswitching it. This will produce a really large loop with lots of empty
+ // blocks.
+ if (L->getBlocks().size() > 2*Threshold)
+ return 2*Threshold;
+
unsigned Cost = 0;
// FIXME: this is brain dead. It should take into consideration code
// shrinkage.
OpenPOWER on IntegriCloud