summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-22 23:37:35 +0000
committerChris Lattner <sabre@nondot.org>2010-04-22 23:37:35 +0000
commit2eee5d3467d1e2944374ab3f5c68456ac7855113 (patch)
treeeccda60b828d649ce94eb8b23e52562209d9c400 /llvm/lib/Transforms/IPO
parentff1915208d94a3a2876dc5d794a27bba44a1c8ae (diff)
downloadbcm5719-llvm-2eee5d3467d1e2944374ab3f5c68456ac7855113.tar.gz
bcm5719-llvm-2eee5d3467d1e2944374ab3f5c68456ac7855113.zip
The inliner was choosing to not consider call sites
that appear in the SCC as a result of inlining as candidates for inlining. Change this so that it *does* consider call sites that change from being indirect to being direct as a result of inlining. This allows it to completely "devirtualize" the testcase. llvm-svn: 102146
Diffstat (limited to 'llvm/lib/Transforms/IPO')
-rw-r--r--llvm/lib/Transforms/IPO/Inliner.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp
index 19b65e8e1f9..1de7b0753d2 100644
--- a/llvm/lib/Transforms/IPO/Inliner.cpp
+++ b/llvm/lib/Transforms/IPO/Inliner.cpp
@@ -383,11 +383,17 @@ bool Inliner::runOnSCC(CallGraphSCC &SCC) {
if (!shouldInline(CS))
continue;
- // Attempt to inline the function...
+ // Attempt to inline the function.
if (!InlineCallIfPossible(CS, InlineInfo, InlinedArrayAllocas))
continue;
++NumInlined;
+ // If inlining this function devirtualized any call sites, throw them
+ // onto our worklist to process. They are useful inline candidates.
+ for (unsigned i = 0, e = InlineInfo.DevirtualizedCalls.size();
+ i != e; ++i)
+ CallSites.push_back(CallSite(InlineInfo.DevirtualizedCalls[i]));
+
// Update the cached cost info with the inlined call.
growCachedCostInfo(Caller, Callee);
}
OpenPOWER on IntegriCloud