Move library call simplification statistic to instcombine
[oota-llvm.git] / lib / Transforms / InstCombine / InstCombineCalls.cpp
index b7b45a2473f430471181467f31ac3a39663a22a0..60244c7ce0a85b58e2375e53325c7fe08429f8a0 100644 (file)
 #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;
 }