[llvm-commits] [llvm] r77358 - /llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp

Andreas Bolka a at bolka.at
Tue Jul 28 12:49:49 PDT 2009


Author: abolka
Date: Tue Jul 28 14:49:49 2009
New Revision: 77358

URL: http://llvm.org/viewvc/llvm-project?rev=77358&view=rev
Log:
Add LDA statistics.

Modified:
    llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp

Modified: llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp?rev=77358&r1=77357&r2=77358&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopDependenceAnalysis.cpp Tue Jul 28 14:49:49 2009
@@ -18,6 +18,7 @@
 //===----------------------------------------------------------------------===//
 
 #define DEBUG_TYPE "lda"
+#include "llvm/ADT/Statistic.h"
 #include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/Analysis/LoopDependenceAnalysis.h"
 #include "llvm/Analysis/LoopPass.h"
@@ -30,6 +31,12 @@
 #include "llvm/Target/TargetData.h"
 using namespace llvm;
 
+STATISTIC(NumAnswered,    "Number of dependence queries answered");
+STATISTIC(NumAnalysed,    "Number of distinct dependence pairs analysed");
+STATISTIC(NumDependent,   "Number of pairs with dependent accesses");
+STATISTIC(NumIndependent, "Number of pairs with independent accesses");
+STATISTIC(NumUnknown,     "Number of pairs with unknown accesses");
+
 LoopPass *llvm::createLoopDependenceAnalysisPass() {
   return new LoopDependenceAnalysis();
 }
@@ -148,11 +155,18 @@
 
 bool LoopDependenceAnalysis::depends(Value *A, Value *B) {
   assert(isDependencePair(A, B) && "Values form no dependence pair!");
+  ++NumAnswered;
 
   DependencePair *p;
   if (!findOrInsertDependencePair(A, B, p)) {
     // The pair is not cached, so analyse it.
+    ++NumAnalysed;
     analysePair(p);
+    switch (p->Result) {
+    case Dependent:   ++NumDependent;   break;
+    case Independent: ++NumIndependent; break;
+    case Unknown:     ++NumUnknown;     break;
+    }
   }
   return p->Result != Independent;
 }





More information about the llvm-commits mailing list