[llvm-commits] [llvm] r85705 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
Chris Lattner
sabre at nondot.org
Sat Oct 31 20:42:55 PDT 2009
Author: lattner
Date: Sat Oct 31 22:42:55 2009
New Revision: 85705
URL: http://llvm.org/viewvc/llvm-project?rev=85705&view=rev
Log:
if CostMetrics says to never duplicate some code, don't unswitch a loop.
This prevents unswitching from duplicating indbr's.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=85705&r1=85704&r2=85705&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Sat Oct 31 22:42:55 2009
@@ -430,7 +430,8 @@
// 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");
More information about the llvm-commits
mailing list