[llvm-commits] [llvm] r122682 - /llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp

Chris Lattner sabre at nondot.org
Sat Jan 1 23:36:44 PST 2011


Author: lattner
Date: Sun Jan  2 01:36:44 2011
New Revision: 122682

URL: http://llvm.org/viewvc/llvm-project?rev=122682&view=rev
Log:
add some -stats output.

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

Modified: llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp?rev=122682&r1=122681&r2=122682&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp Sun Jan  2 01:36:44 2011
@@ -25,10 +25,13 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/IRBuilder.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/ADT/Statistic.h"
 using namespace llvm;
 
 // TODO: Recognize "N" size array multiplies: replace with call to blas or
 // something.
+STATISTIC(NumMemSet, "Number of memset's formed from loop stores");
+STATISTIC(NumMemCpy, "Number of memcpy's formed from loop load+stores");
 
 namespace {
   class LoopIdiomRecognize : public LoopPass {
@@ -123,6 +126,10 @@
 bool LoopIdiomRecognize::runOnLoop(Loop *L, LPPassManager &LPM) {
   CurLoop = L;
   
+  if (L->getHeader()->getName().startswith("bb29")) {
+    errs() << *L->getHeader();
+  }
+  
   // We only look at trivial single basic block loops.
   // TODO: eventually support more complex loops, scanning the header.
   if (L->getBlocks().size() != 1)
@@ -210,7 +217,7 @@
       if (processLoopStoreOfLoopLoad(SI, StoreSize, StoreEv, LoadEv, BECount))
         return true;
   }
- // errs() << "UNHANDLED strided store: " << *Ev << " - " << *SI << "\n";
+  //errs() << "UNHANDLED strided store: " << *StoreEv << " - " << *SI << "\n";
 
   return false;
 }
@@ -309,6 +316,7 @@
   // Okay, the memset has been formed.  Zap the original store and anything that
   // feeds into it.
   DeleteDeadInstruction(SI, *SE);
+  ++NumMemSet;
   return true;
 }
 
@@ -379,5 +387,6 @@
   // Okay, the memset has been formed.  Zap the original store and anything that
   // feeds into it.
   DeleteDeadInstruction(SI, *SE);
+  ++NumMemCpy;
   return true;
 }





More information about the llvm-commits mailing list