[llvm-commits] [llvm] r114919 - /llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
Owen Anderson
resistor at mac.com
Mon Sep 27 15:58:54 PDT 2010
Author: resistor
Date: Mon Sep 27 17:58:54 2010
New Revision: 114919
URL: http://llvm.org/viewvc/llvm-project?rev=114919&view=rev
Log:
Weight loop unrolling counts by nesting depth. Unrolling deeply nested loops tends to cause high
register pressure and thus excess spills, which we don't currently recover from well. This should
be re-evaluated in the future if our ability to generate good spills/splits improves.
Partial fix for <rdar://problem/7635585>.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp?rev=114919&r1=114918&r2=114919&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp Mon Sep 27 17:58:54 2010
@@ -158,7 +158,12 @@
DEBUG(dbgs() << " Not unrolling loop with inlinable calls.\n");
return false;
}
- uint64_t Size = (uint64_t)LoopSize*Count;
+
+ // NOTE: We multiply by the loop depth because unrolling inner loops of
+ // very deep nests tends to result in high register pressure, which we don't
+ // currently recover from very well. When and if the register allocator/
+ // spiller improves to compensate, this should be re-evaluated.
+ uint64_t Size = (uint64_t)LoopSize*Count*L->getLoopDepth();
if (TripCount != 1 && Size > CurrentThreshold) {
DEBUG(dbgs() << " Too large to fully unroll with count: " << Count
<< " because size: " << Size << ">" << CurrentThreshold << "\n");
More information about the llvm-commits
mailing list