summaryrefslogtreecommitdiff
path: root/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
commitdaa2bf9a192496a456b548fbb6787cdcee183c70 (patch)
treebaa796143d1c44da31a3332efe910de69be1717c /lib
parentee12e8f28dc520cbc98555bc18749c2828c05495 (diff)
downloadllvm-daa2bf9a192496a456b548fbb6787cdcee183c70.tar.gz
llvm-daa2bf9a192496a456b548fbb6787cdcee183c70.tar.bz2
llvm-daa2bf9a192496a456b548fbb6787cdcee183c70.tar.xz
Don't unswitch really large loops even if they are mostly filled with empty
blocks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28959 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/LoopUnswitch.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp
index d33dcb7c0b..945803f0af 100644
--- a/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/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.