diff options
| author | Owen Anderson <resistor@mac.com> | 2010-09-08 23:10:07 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2010-09-08 23:10:07 +0000 |
| commit | e38efa2eba8f808d3fd4120300381749dc205904 (patch) | |
| tree | 302d6650be2016088a5da0518a2b319d7c973ac5 /lib/Transforms | |
| parent | b6c0d47d76c5ef1f3fc70b9517fa6ae98e23a277 (diff) | |
| download | external_llvm-e38efa2eba8f808d3fd4120300381749dc205904.zip external_llvm-e38efa2eba8f808d3fd4120300381749dc205904.tar.gz external_llvm-e38efa2eba8f808d3fd4120300381749dc205904.tar.bz2 | |
Relax the "don't unroll loops containing calls" rule. Instead, when a loop contains a call, lower the
unrolling threshold to the optimize-for-size threshold. Basically, for loops containing calls, unrolling
can still be profitable as long as the loop is REALLY small.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113439 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
| -rw-r--r-- | lib/Transforms/Scalar/LoopUnrollPass.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopUnrollPass.cpp b/lib/Transforms/Scalar/LoopUnrollPass.cpp index f20f7dc..f0a661c 100644 --- a/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -132,8 +132,10 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) { unsigned LoopSize = ApproximateLoopSize(L, NumCalls); DEBUG(dbgs() << " Loop Size = " << LoopSize << "\n"); if (NumCalls != 0) { - DEBUG(dbgs() << " Not unrolling loop with function calls.\n"); - return false; + // Even for a loop that contains calls, it can still be profitable to + // unroll if the loop is really, REALLY small. + DEBUG(dbgs() <<" Using lower threshold for loop with function calls.\n"); + CurrentThreshold = OptSizeUnrollThreshold; } uint64_t Size = (uint64_t)LoopSize*Count; if (TripCount != 1 && Size > CurrentThreshold) { |
