aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-04-11 10:15:10 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-04-11 10:15:10 +0000
commitd6fc26217e194372cabe4ef9e2514beac511a943 (patch)
tree5d19924ed9cb71a8423190737004561b5226c1e0
parent2e506198c8cc7eec8f2f4fb4719a07daef17f931 (diff)
downloadexternal_llvm-d6fc26217e194372cabe4ef9e2514beac511a943.zip
external_llvm-d6fc26217e194372cabe4ef9e2514beac511a943.tar.gz
external_llvm-d6fc26217e194372cabe4ef9e2514beac511a943.tar.bz2
Add two statistics to help track how we are computing the inline cost.
Yea, 'NumCallerCallersAnalyzed' isn't a great name, suggestions welcome. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154492 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/InlineCost.cpp5
-rw-r--r--lib/Transforms/IPO/Inliner.cpp6
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/Analysis/InlineCost.cpp b/lib/Analysis/InlineCost.cpp
index c4599c8..3e3d2ab 100644
--- a/lib/Analysis/InlineCost.cpp
+++ b/lib/Analysis/InlineCost.cpp
@@ -29,9 +29,12 @@
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/Statistic.h"
using namespace llvm;
+STATISTIC(NumCallsAnalyzed, "Number of call sites analyzed");
+
namespace {
class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> {
@@ -802,6 +805,8 @@ ConstantInt *CallAnalyzer::stripAndComputeInBoundsConstantOffsets(Value *&V) {
/// is below the computed threshold, then inlining was forcibly disabled by
/// some artifact of the rountine.
bool CallAnalyzer::analyzeCall(CallSite CS) {
+ ++NumCallsAnalyzed;
+
// Track whether the post-inlining function would have more than one basic
// block. A single basic block is often intended for inlining. Balloon the
// threshold by 50% until we pass the single-BB phase.
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp
index 8a9d149..dc9cbfb 100644
--- a/lib/Transforms/IPO/Inliner.cpp
+++ b/lib/Transforms/IPO/Inliner.cpp
@@ -36,6 +36,11 @@ STATISTIC(NumCallsDeleted, "Number of call sites deleted, not inlined");
STATISTIC(NumDeleted, "Number of functions deleted because all callers found");
STATISTIC(NumMergedAllocas, "Number of allocas merged together");
+// This weirdly named statistic tracks the number of times that, when attemting
+// to inline a function A into B, we analyze the callers of B in order to see
+// if those would be more profitable and blocked inline steps.
+STATISTIC(NumCallerCallersAnalyzed, "Number of caller-callers analyzed");
+
static cl::opt<int>
InlineLimit("inline-threshold", cl::Hidden, cl::init(225), cl::ZeroOrMore,
cl::desc("Control the amount of inlining to perform (default = 225)"));
@@ -277,6 +282,7 @@ bool Inliner::shouldInline(CallSite CS) {
}
InlineCost IC2 = getInlineCost(CS2);
+ ++NumCallerCallersAnalyzed;
if (!IC2) {
callerWillBeRemoved = false;
continue;