summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-09-27 22:58:54 +0000
committerOwen Anderson <resistor@mac.com>2010-09-27 22:58:54 +0000
commit9c93fd5598f27d158ce5c01b81d1af79034121af (patch)
tree34fd6bf6b39596dc61c38bdcb48c8c49693bb8d4 /llvm/lib/Transforms
parent8f9ebe54b3c5914b4c7cf356b0885ed9e4a7f682 (diff)
downloadbcm5719-llvm-9c93fd5598f27d158ce5c01b81d1af79034121af.tar.gz
bcm5719-llvm-9c93fd5598f27d158ce5c01b81d1af79034121af.zip
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>. llvm-svn: 114919
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
index 7da2b52da54..99a38b1ed01 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
@@ -158,7 +158,12 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
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");
OpenPOWER on IntegriCloud