forked from OSchip/llvm-project
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:
parent
54a4b84012
commit
7a8db3a41a
|
@ -430,7 +430,8 @@ bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val){
|
||||||
// large numbers of branches which cause loop unswitching to go crazy.
|
// large numbers of branches which cause loop unswitching to go crazy.
|
||||||
// This is a very ad-hoc heuristic.
|
// This is a very ad-hoc heuristic.
|
||||||
if (Metrics.NumInsts > Threshold ||
|
if (Metrics.NumInsts > Threshold ||
|
||||||
Metrics.NumBlocks * 5 > Threshold) {
|
Metrics.NumBlocks * 5 > Threshold ||
|
||||||
|
Metrics.NeverInline) {
|
||||||
DEBUG(errs() << "NOT unswitching loop %"
|
DEBUG(errs() << "NOT unswitching loop %"
|
||||||
<< currentLoop->getHeader()->getName() << ", cost too high: "
|
<< currentLoop->getHeader()->getName() << ", cost too high: "
|
||||||
<< currentLoop->getBlocks().size() << "\n");
|
<< currentLoop->getBlocks().size() << "\n");
|
||||||
|
|
Loading…
Reference in New Issue