Switch to a very conservative heuristic for determining when loop-unswitching

will be profitable.  This is mainly to remove some cases where excessive
unswitching would result in long compile times and/or huge generated code.

Once someone comes up with a better heuristic that avoids these cases, this
should be switched out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28962 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2006-06-28 17:47:50 +00:00
parent d228018396
commit 372994be25

View File

@ -333,11 +333,11 @@ unsigned LoopUnswitch::getLoopUnswitchCost(Loop *L, Value *LIC) {
if (IsTrivialUnswitchCondition(L, LIC)) if (IsTrivialUnswitchCondition(L, LIC))
return 0; return 0;
// If the loop is really large (over twice our threshold) don't even consider // FIXME: This is really overly conservative. However, more liberal
// unswitching it. This will produce a really large loop with lots of empty // estimations have thus far resulted in excessive unswitching, which is bad
// blocks. // both in compile time and in code size. This should be replaced once
if (L->getBlocks().size() > 2*Threshold) // someone figures out how a good estimation.
return 2*Threshold; return L->getBlocks().size();
unsigned Cost = 0; unsigned Cost = 0;
// FIXME: this is brain dead. It should take into consideration code // FIXME: this is brain dead. It should take into consideration code