summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-01-02 07:36:44 +0000
committerChris Lattner <sabre@nondot.org>2011-01-02 07:36:44 +0000
commit12f91befcee00c339c9bd4804f2fc83960de7758 (patch)
treebf5bd981529862541fa3130e82cdbe7e762c1358 /llvm/lib/Transforms
parent679572e584bf9e5ab62a580c4f55a8f1c60dfe62 (diff)
downloadbcm5719-llvm-12f91befcee00c339c9bd4804f2fc83960de7758.tar.gz
bcm5719-llvm-12f91befcee00c339c9bd4804f2fc83960de7758.zip
add some -stats output.
llvm-svn: 122682
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
index 97f9ef2fa04..a2f7b58be1f 100644
--- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -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 @@ static void DeleteDeadInstruction(Instruction *I, ScalarEvolution &SE) {
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 @@ bool LoopIdiomRecognize::processLoopStore(StoreInst *SI, const SCEV *BECount) {
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 @@ processLoopStoreOfSplatValue(StoreInst *SI, unsigned StoreSize,
// 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 @@ processLoopStoreOfLoopLoad(StoreInst *SI, unsigned StoreSize,
// Okay, the memset has been formed. Zap the original store and anything that
// feeds into it.
DeleteDeadInstruction(SI, *SE);
+ ++NumMemCpy;
return true;
}
OpenPOWER on IntegriCloud