[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LCSSA.cpp

Owen Anderson resistor at mac.com
Fri May 26 17:31:49 PDT 2006



Changes in directory llvm/lib/Transforms/Scalar:

LCSSA.cpp updated: 1.3 -> 1.4
---
Log message:

A few small clean-ups, and the addition of an LCSSA statistic.


---
Diffs of the changes:  (+8 -2)

 LCSSA.cpp |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/Scalar/LCSSA.cpp
diff -u llvm/lib/Transforms/Scalar/LCSSA.cpp:1.3 llvm/lib/Transforms/Scalar/LCSSA.cpp:1.4
--- llvm/lib/Transforms/Scalar/LCSSA.cpp:1.3	Fri May 26 16:19:17 2006
+++ llvm/lib/Transforms/Scalar/LCSSA.cpp	Fri May 26 19:31:37 2006
@@ -31,18 +31,22 @@
 #include "llvm/Pass.h"
 #include "llvm/Function.h"
 #include "llvm/Instructions.h"
+#include "llvm/ADT/Statistic.h"
 #include "llvm/Analysis/Dominators.h"
 #include "llvm/Analysis/LoopInfo.h"
 #include "llvm/Support/CFG.h"
 #include <algorithm>
-#include <set>
 #include <vector>
 
 using namespace llvm;
 
 namespace {
+  static Statistic<> NumLCSSA("lcssa", "Number of times LCSSA was applied");
+  
   class LCSSA : public FunctionPass {
   public:
+    
+  
     LoopInfo *LI;  // Loop information
     DominatorTree *DT;       // Dominator Tree for the current Loop...
     DominanceFrontier *DF;   // Current Dominance Frontier
@@ -51,7 +55,8 @@
     bool visitSubloop(Loop* L);
     
     /// This transformation requires natural loop information & requires that
-    /// loop preheaders be inserted into the CFG...
+    /// loop preheaders be inserted into the CFG.  It maintains both of these,
+    /// as well as the CFG.  It also requires dominator information.
     ///
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesCFG();
@@ -102,6 +107,7 @@
   
   for (std::set<Instruction*>::iterator I = AffectedValues.begin(),
        E = AffectedValues.end(); I != E; ++I) {
+    ++NumLCSSA; // We are applying the transformation
     for (std::vector<BasicBlock*>::iterator BBI = exitBlocks.begin(),
          BBE = exitBlocks.end(); BBI != BBE; ++BBI) {
       PHINode *phi = new PHINode((*I)->getType(), "lcssa");






More information about the llvm-commits mailing list