From: Chris Lattner Date: Sun, 1 Nov 2009 03:42:55 +0000 (+0000) Subject: if CostMetrics says to never duplicate some code, don't unswitch a loop. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=da9c281121537d9823ddeecf7bb15095d95b2722;p=oota-llvm.git 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 --- diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index 223d2b9869c..c7b00da159c 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -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");