Skip to content

Commit

Permalink
Move library call simplification statistic to instcombine
Browse files Browse the repository at this point in the history
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168975 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
meadori committed Nov 30, 2012
1 parent 84bcf93 commit 63f932c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/Transforms/InstCombine/InstCombineCalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 0 additions & 2 deletions lib/Transforms/Scalar/SimplifyLibCalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 63f932c

Please sign in to comment.