diff options
author | Owen Anderson <resistor@mac.com> | 2010-09-09 20:32:23 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2010-09-09 20:32:23 +0000 |
commit | 04cf3fd7612150cfb3e0f92b490d821a0dd7aa0c (patch) | |
tree | e517e256622550619c147103ed230d242db45d4e /llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | |
parent | 324f8b798fb28f4eb04e9e5dc44e3c3cdf63b398 (diff) | |
download | bcm5719-llvm-04cf3fd7612150cfb3e0f92b490d821a0dd7aa0c.tar.gz bcm5719-llvm-04cf3fd7612150cfb3e0f92b490d821a0dd7aa0c.zip |
What the loop unroller cares about, rather than just not unrolling loops with calls, is
not unrolling loops that contain calls that would be better off getting inlined. This mostly
comes up when an interleaved devirtualization pass has devirtualized a call which the inliner
will inline on a future pass. Thus, rather than blocking all loops containing calls, add
a metric for "inline candidate calls" and block loops containing those instead.
llvm-svn: 113535
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index 7968939f11d..806f63d1043 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -89,7 +89,7 @@ static unsigned ApproximateLoopSize(const Loop *L, unsigned &NumCalls) { for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); I != E; ++I) Metrics.analyzeBasicBlock(*I); - NumCalls = Metrics.NumCalls; + NumCalls = Metrics.NumInlineCandidates; unsigned LoopSize = Metrics.NumInsts; @@ -151,11 +151,11 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) { // Enforce the threshold. if (CurrentThreshold != NoThreshold) { - unsigned NumCalls; - unsigned LoopSize = ApproximateLoopSize(L, NumCalls); + unsigned NumInlineCandidates; + unsigned LoopSize = ApproximateLoopSize(L, NumInlineCandidates); DEBUG(dbgs() << " Loop Size = " << LoopSize << "\n"); - if (NumCalls != 0) { - DEBUG(dbgs() << " Not unrolling loop with function calls.\n"); + if (NumInlineCandidates != 0) { + DEBUG(dbgs() << " Not unrolling loop with inlinable calls.\n"); return false; } uint64_t Size = (uint64_t)LoopSize*Count; |