[llvm-commits] [llvm] r80915 - /llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp

Duncan Sands baldrick at free.fr
Thu Sep 3 06:37:16 PDT 2009


Author: baldrick
Date: Thu Sep  3 08:37:16 2009
New Revision: 80915

URL: http://llvm.org/viewvc/llvm-project?rev=80915&view=rev
Log:
Keep track of how many memmove calls were turned into
memcpy calls.

Modified:
    llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=80915&r1=80914&r2=80915&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Thu Sep  3 08:37:16 2009
@@ -31,6 +31,7 @@
 
 STATISTIC(NumMemCpyInstr, "Number of memcpy instructions deleted");
 STATISTIC(NumMemSetInfer, "Number of memsets inferred");
+STATISTIC(NumMoveToCpy,   "Number of memmoves converted to memcpy");
 
 /// isBytewiseValue - If the specified value can be set by repeating the same
 /// byte in memory, return the i8 value that it is represented with.  This is
@@ -728,10 +729,12 @@
   Module *Mod = M->getParent()->getParent()->getParent();
   const Type *Ty = M->getLength()->getType();
   M->setOperand(0, Intrinsic::getDeclaration(Mod, Intrinsic::memcpy, &Ty, 1));
-  
+
   // MemDep may have over conservative information about this instruction, just
   // conservatively flush it from the cache.
   getAnalysis<MemoryDependenceAnalysis>().removeInstruction(M);
+
+  ++NumMoveToCpy;
   return true;
 }
   





More information about the llvm-commits mailing list