Make sure to include name information if we have it
[oota-llvm.git] / lib / Transforms / IPO / ConstantMerge.cpp
index b979104401c8bb04be1b2242a10f42e1ae5f106e..a73fca2b3c5269e9c6831ead3c826374b431c95a 100644 (file)
@@ -3,45 +3,34 @@
 // This file defines the interface to a pass that merges duplicate global
 // constants together into a single constant that is shared.  This is useful
 // because some passes (ie TraceValues) insert a lot of string constants into
-// the program, regardless of whether or not they duplicate an existing string.
+// the program, regardless of whether or not an existing string is available.
 //
 // Algorithm: ConstantMerge is designed to build up a map of available constants
-// and elminate duplicates when it is initialized.
-//
-// The DynamicConstantMerge method is a superset of the ConstantMerge algorithm
-// that checks for each function to see if constants have been added to the
-// constant pool since it was last run... if so, it processes them.
+// and eliminate duplicates when it is initialized.
 //
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Transforms/IPO.h"
 #include "llvm/Module.h"
 #include "llvm/Pass.h"
-#include "Support/StatisticReporter.h"
+#include "Support/Statistic.h"
 
 namespace {
+  Statistic<> NumMerged("constmerge", "Number of global constants merged");
+
   struct ConstantMerge : public Pass {
     // run - For this pass, process all of the globals in the module,
     // eliminating duplicate constants.
     //
     bool run(Module &M);
-
-    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
-      AU.preservesCFG();
-    }
   };
 
-  Statistic<> NumMerged("constmerge\t\t- Number of global constants merged");
   RegisterOpt<ConstantMerge> X("constmerge","Merge Duplicate Global Constants");
 }
 
 Pass *createConstantMergePass() { return new ConstantMerge(); }
 
 
-// ConstantMerge::run - Workhorse for the pass.  This eliminates duplicate
-// constants, starting at global ConstantNo, and adds vars to the map if they
-// are new and unique.
-//
 bool ConstantMerge::run(Module &M) {
   std::map<Constant*, GlobalVariable*> CMap;
   bool MadeChanges = false;