From e3f2b26bfadb34a1eb8028a916bd90697eaafe20 Mon Sep 17 00:00:00 2001 From: Meador Inge Date: Fri, 30 Nov 2012 04:05:06 +0000 Subject: [PATCH] Move library call simplification statistic to instcombine The simplify-libcalls pass maintained a statistic to count the number of library calls that have been simplified. Now that library call simplification is being carried out in instcombine the statistic should be moved to there. llvm-svn: 168975 --- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 7 ++++++- llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp | 2 -- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index b7b45a2473f4..60244c7ce0a8 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -14,11 +14,14 @@ #include "InstCombine.h" #include "llvm/Support/CallSite.h" #include "llvm/DataLayout.h" +#include "llvm/ADT/Statistic.h" #include "llvm/Analysis/MemoryBuiltins.h" #include "llvm/Transforms/Utils/BuildLibCalls.h" #include "llvm/Transforms/Utils/Local.h" using namespace llvm; +STATISTIC(NumSimplified, "Number of library calls simplified"); + /// getPromotedType - Return the specified type promoted as it would be to pass /// though a va_arg area. static Type *getPromotedType(Type *Ty) { @@ -785,8 +788,10 @@ static bool isSafeToEliminateVarargsCast(const CallSite CS, Instruction *InstCombiner::tryOptimizeCall(CallInst *CI, const DataLayout *TD) { if (CI->getCalledFunction() == 0) return 0; - if (Value *With = Simplifier->optimizeCall(CI)) + if (Value *With = Simplifier->optimizeCall(CI)) { + ++NumSimplified; return CI->use_empty() ? CI : ReplaceInstUsesWith(*CI, With); + } return 0; } diff --git a/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp index 43fff858a1ef..0d3a2e0a5c8b 100644 --- a/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Scalar/SimplifyLibCalls.cpp @@ -35,7 +35,6 @@ #include "llvm/Config/config.h" // FIXME: Shouldn't depend on host! using namespace llvm; -STATISTIC(NumSimplified, "Number of library calls simplified"); STATISTIC(NumAnnotated, "Number of attributes added to library functions"); //===----------------------------------------------------------------------===// @@ -193,7 +192,6 @@ bool SimplifyLibCalls::runOnFunction(Function &F) { // Something changed! Changed = true; - ++NumSimplified; // Inspect the instruction after the call (which was potentially just // added) next.