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

This prevents unswitching from duplicating indbr's.

llvm-svn: 85705
This commit is contained in:
Chris Lattner 2009-11-01 03:42:55 +00:00
parent 54a4b84012
commit 7a8db3a41a
1 changed files with 2 additions and 1 deletions

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");