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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102146 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp
index 19b65e8..1de7b07 100644
--- a/lib/Transforms/IPO/Inliner.cpp
+++ b/lib/Transforms/IPO/Inliner.cpp
@@ -383,11 +383,17 @@
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);
}