[llvm-commits] [llvm] r154492 - in /llvm/trunk/lib: Analysis/InlineCost.cpp Transforms/IPO/Inliner.cpp
Chandler Carruth
chandlerc at gmail.com
Wed Apr 11 03:15:10 PDT 2012
Author: chandlerc
Date: Wed Apr 11 05:15:10 2012
New Revision: 154492
URL: http://llvm.org/viewvc/llvm-project?rev=154492&view=rev
Log:
Add two statistics to help track how we are computing the inline cost.
Yea, 'NumCallerCallersAnalyzed' isn't a great name, suggestions welcome.
Modified:
llvm/trunk/lib/Analysis/InlineCost.cpp
llvm/trunk/lib/Transforms/IPO/Inliner.cpp
Modified: llvm/trunk/lib/Analysis/InlineCost.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=154492&r1=154491&r2=154492&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InlineCost.cpp (original)
+++ llvm/trunk/lib/Analysis/InlineCost.cpp Wed Apr 11 05:15:10 2012
@@ -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 @@
/// 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.
Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=154492&r1=154491&r2=154492&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Wed Apr 11 05:15:10 2012
@@ -36,6 +36,11 @@
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 @@
}
InlineCost IC2 = getInlineCost(CS2);
+ ++NumCallerCallersAnalyzed;
if (!IC2) {
callerWillBeRemoved = false;
continue;
More information about the llvm-commits
mailing list