[llvm-commits] [llvm] r168975 - in /llvm/trunk/lib/Transforms: InstCombine/InstCombineCalls.cpp Scalar/SimplifyLibCalls.cpp

Meador Inge meadori at codesourcery.com
Thu Nov 29 20:05:07 PST 2012


Author: meadori
Date: Thu Nov 29 22:05:06 2012
New Revision: 168975

URL: http://llvm.org/viewvc/llvm-project?rev=168975&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
    llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=168975&r1=168974&r2=168975&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Thu Nov 29 22:05:06 2012
@@ -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 @@
 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;
 }

Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=168975&r1=168974&r2=168975&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Thu Nov 29 22:05:06 2012
@@ -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 @@
 
       // Something changed!
       Changed = true;
-      ++NumSimplified;
 
       // Inspect the instruction after the call (which was potentially just
       // added) next.





More information about the llvm-commits mailing list