if CostMetrics says to never duplicate some code, don't unswitch a loop.

This prevents unswitching from duplicating indbr's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85705 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-11-01 03:42:55 +00:00
parent 0a4c6789d5
commit da9c281121

View File

@ -430,7 +430,8 @@ bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val){
// large numbers of branches which cause loop unswitching to go crazy.
// This is a very ad-hoc heuristic.
if (Metrics.NumInsts > Threshold ||
Metrics.NumBlocks * 5 > Threshold) {
Metrics.NumBlocks * 5 > Threshold ||
Metrics.NeverInline) {
DEBUG(errs() << "NOT unswitching loop %"
<< currentLoop->getHeader()->getName() << ", cost too high: "
<< currentLoop->getBlocks().size() << "\n");