merge in jb-release history after reset to jb-dev
diff --git a/BitWriter_2_9/BitcodeWriter.cpp b/BitWriter_2_9/BitcodeWriter.cpp
index 1c5f325..202aa21 100644
--- a/BitWriter_2_9/BitcodeWriter.cpp
+++ b/BitWriter_2_9/BitcodeWriter.cpp
@@ -132,7 +132,7 @@
 }
 
 // Emit information about parameter attributes.
-static void WriteAttributeTable(const llvm_2_9::ValueEnumerator &VE,
+static void WriteAttributeTable(const ValueEnumerator &VE,
                                 BitstreamWriter &Stream) {
   const std::vector<AttrListPtr> &Attrs = VE.getAttributes();
   if (Attrs.empty()) return;
@@ -166,9 +166,9 @@
   Stream.ExitBlock();
 }
 
-static void WriteTypeSymbolTable(const llvm_2_9::ValueEnumerator &VE,
+static void WriteTypeSymbolTable(const ValueEnumerator &VE,
                                  BitstreamWriter &Stream) {
-  const llvm_2_9::ValueEnumerator::TypeList &TypeList = VE.getTypes();
+  const ValueEnumerator::TypeList &TypeList = VE.getTypes();
   Stream.EnterSubblock(TYPE_SYMTAB_BLOCK_ID_OLD_3_0, 3);
 
   // 7-bit fixed width VST_CODE_ENTRY strings.
@@ -239,9 +239,8 @@
 }
 
 /// WriteTypeTable - Write out the type table for a module.
-static void WriteTypeTable(const llvm_2_9::ValueEnumerator &VE,
-                           BitstreamWriter &Stream) {
-  const llvm_2_9::ValueEnumerator::TypeList &TypeList = VE.getTypes();
+static void WriteTypeTable(const ValueEnumerator &VE, BitstreamWriter &Stream) {
+  const ValueEnumerator::TypeList &TypeList = VE.getTypes();
 
   Stream.EnterSubblock(TYPE_BLOCK_ID_OLD_3_0, 4 /*count from # abbrevs */);
   SmallVector<uint64_t, 64> TypeVals;
@@ -430,8 +429,7 @@
 
 // Emit top-level description of module, including target triple, inline asm,
 // descriptors for global variables, and function prototype info.
-static void WriteModuleInfo(const Module *M,
-                            const llvm_2_9::ValueEnumerator &VE,
+static void WriteModuleInfo(const Module *M, const ValueEnumerator &VE,
                             BitstreamWriter &Stream) {
   // Emit the list of dependent libraries for the Module.
   for (Module::lib_iterator I = M->lib_begin(), E = M->lib_end(); I != E; ++I)
@@ -598,7 +596,7 @@
 }
 
 static void WriteMDNode(const MDNode *N,
-                        const llvm_2_9::ValueEnumerator &VE,
+                        const ValueEnumerator &VE,
                         BitstreamWriter &Stream,
                         SmallVector<uint64_t, 64> &Record) {
   for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
@@ -617,9 +615,9 @@
 }
 
 static void WriteModuleMetadata(const Module *M,
-                                const llvm_2_9::ValueEnumerator &VE,
+                                const ValueEnumerator &VE,
                                 BitstreamWriter &Stream) {
-  const llvm_2_9::ValueEnumerator::ValueList &Vals = VE.getMDValues();
+  const ValueEnumerator::ValueList &Vals = VE.getMDValues();
   bool StartedMetadataBlock = false;
   unsigned MDSAbbrev = 0;
   SmallVector<uint64_t, 64> Record;
@@ -683,7 +681,7 @@
 }
 
 static void WriteFunctionLocalMetadata(const Function &F,
-                                       const llvm_2_9::ValueEnumerator &VE,
+                                       const ValueEnumerator &VE,
                                        BitstreamWriter &Stream) {
   bool StartedMetadataBlock = false;
   SmallVector<uint64_t, 64> Record;
@@ -703,7 +701,7 @@
 }
 
 static void WriteMetadataAttachment(const Function &F,
-                                    const llvm_2_9::ValueEnumerator &VE,
+                                    const ValueEnumerator &VE,
                                     BitstreamWriter &Stream) {
   Stream.EnterSubblock(bitc::METADATA_ATTACHMENT_ID, 3);
 
@@ -760,7 +758,7 @@
 }
 
 static void WriteConstants(unsigned FirstVal, unsigned LastVal,
-                           const llvm_2_9::ValueEnumerator &VE,
+                           const ValueEnumerator &VE,
                            BitstreamWriter &Stream, bool isGlobal) {
   if (FirstVal == LastVal) return;
 
@@ -801,7 +799,7 @@
 
   SmallVector<uint64_t, 64> Record;
 
-  const llvm_2_9::ValueEnumerator::ValueList &Vals = VE.getValues();
+  const ValueEnumerator::ValueList &Vals = VE.getValues();
   Type *LastTy = 0;
   for (unsigned i = FirstVal; i != LastVal; ++i) {
     const Value *V = Vals[i].first;
@@ -914,14 +912,25 @@
         AbbrevToUse = CString7Abbrev;
     } else if (const ConstantDataSequential *CDS = 
                   dyn_cast<ConstantDataSequential>(C)) {
-      // We must replace ConstantDataSequential's representation with the
-      // legacy ConstantArray/ConstantVector/ConstantStruct version.
-      // ValueEnumerator is similarly modified to mark the appropriate
-      // Constants as used (so they are emitted).
-      Code = bitc::CST_CODE_AGGREGATE;
-      for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i)
-        Record.push_back(VE.getValueID(CDS->getElementAsConstant(i)));
-      AbbrevToUse = AggregateAbbrev;
+      Code = bitc::CST_CODE_DATA;
+      Type *EltTy = CDS->getType()->getElementType();
+      if (isa<IntegerType>(EltTy)) {
+        for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i)
+          Record.push_back(CDS->getElementAsInteger(i));
+      } else if (EltTy->isFloatTy()) {
+        for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
+          union { float F; uint32_t I; };
+          F = CDS->getElementAsFloat(i);
+          Record.push_back(I);
+        }
+      } else {
+        assert(EltTy->isDoubleTy() && "Unknown ConstantData element type");
+        for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
+          union { double F; uint64_t I; };
+          F = CDS->getElementAsDouble(i);
+          Record.push_back(I);
+        }
+      }
     } else if (isa<ConstantArray>(C) || isa<ConstantStruct>(C) ||
                isa<ConstantVector>(C)) {
       Code = bitc::CST_CODE_AGGREGATE;
@@ -1017,9 +1026,9 @@
   Stream.ExitBlock();
 }
 
-static void WriteModuleConstants(const llvm_2_9::ValueEnumerator &VE,
+static void WriteModuleConstants(const ValueEnumerator &VE,
                                  BitstreamWriter &Stream) {
-  const llvm_2_9::ValueEnumerator::ValueList &Vals = VE.getValues();
+  const ValueEnumerator::ValueList &Vals = VE.getValues();
 
   // Find the first constant to emit, which is the first non-globalvalue value.
   // We know globalvalues have been emitted by WriteModuleInfo.
@@ -1041,7 +1050,7 @@
 /// type ID.
 static bool PushValueAndType(const Value *V, unsigned InstID,
                              SmallVector<unsigned, 64> &Vals,
-                             llvm_2_9::ValueEnumerator &VE) {
+                             ValueEnumerator &VE) {
   unsigned ValID = VE.getValueID(V);
   Vals.push_back(ValID);
   if (ValID >= InstID) {
@@ -1053,8 +1062,7 @@
 
 /// WriteInstruction - Emit an instruction to the specified stream.
 static void WriteInstruction(const Instruction &I, unsigned InstID,
-                             llvm_2_9::ValueEnumerator &VE,
-                             BitstreamWriter &Stream,
+                             ValueEnumerator &VE, BitstreamWriter &Stream,
                              SmallVector<unsigned, 64> &Vals) {
   unsigned Code = 0;
   unsigned AbbrevToUse = 0;
@@ -1279,7 +1287,7 @@
 
 // Emit names for globals/functions etc.
 static void WriteValueSymbolTable(const ValueSymbolTable &VST,
-                                  const llvm_2_9::ValueEnumerator &VE,
+                                  const ValueEnumerator &VE,
                                   BitstreamWriter &Stream) {
   if (VST.empty()) return;
   Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 4);
@@ -1336,7 +1344,7 @@
 }
 
 /// WriteFunction - Emit a function body to the module stream.
-static void WriteFunction(const Function &F, llvm_2_9::ValueEnumerator &VE,
+static void WriteFunction(const Function &F, ValueEnumerator &VE,
                           BitstreamWriter &Stream) {
   Stream.EnterSubblock(bitc::FUNCTION_BLOCK_ID, 4);
   VE.incorporateFunction(F);
@@ -1408,8 +1416,7 @@
 }
 
 // Emit blockinfo, which defines the standard abbreviations etc.
-static void WriteBlockInfo(const llvm_2_9::ValueEnumerator &VE,
-                           BitstreamWriter &Stream) {
+static void WriteBlockInfo(const ValueEnumerator &VE, BitstreamWriter &Stream) {
   // We only want to emit block info records for blocks that have multiple
   // instances: CONSTANTS_BLOCK, FUNCTION_BLOCK and VALUE_SYMTAB_BLOCK.  Other
   // blocks can defined their abbrevs inline.
@@ -1582,7 +1589,7 @@
   }
 
   // Analyze the module, enumerating globals, functions, etc.
-  llvm_2_9::ValueEnumerator VE(M);
+  ValueEnumerator VE(M);
 
   // Emit blockinfo, which defines the standard abbreviations etc.
   WriteBlockInfo(VE, Stream);
diff --git a/BitWriter_2_9/ValueEnumerator.cpp b/BitWriter_2_9/ValueEnumerator.cpp
index b1cbbe9..3764dec 100644
--- a/BitWriter_2_9/ValueEnumerator.cpp
+++ b/BitWriter_2_9/ValueEnumerator.cpp
@@ -19,13 +19,9 @@
 #include "llvm/Module.h"
 #include "llvm/ValueSymbolTable.h"
 #include "llvm/Instructions.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/Support/raw_ostream.h"
 #include <algorithm>
 using namespace llvm;
 
-namespace llvm_2_9 {
-
 static bool isIntegerValue(const std::pair<const Value*, unsigned> &V) {
   return V.first->getType()->isIntegerTy();
 }
@@ -111,6 +107,7 @@
   OptimizeConstants(FirstConstant, Values.size());
 }
 
+
 unsigned ValueEnumerator::getInstructionID(const Instruction *Inst) const {
   InstructionMapType::const_iterator I = InstructionMap.find(Inst);
   assert(I != InstructionMap.end() && "Instruction is not mapped!");
@@ -133,43 +130,6 @@
   return I->second-1;
 }
 
-void ValueEnumerator::dump() const {
-  print(dbgs(), ValueMap, "Default");
-  dbgs() << '\n';
-  print(dbgs(), MDValueMap, "MetaData");
-  dbgs() << '\n';
-}
-
-void ValueEnumerator::print(raw_ostream &OS, const ValueMapType &Map,
-                            const char *Name) const {
-
-  OS << "Map Name: " << Name << "\n";
-  OS << "Size: " << Map.size() << "\n";
-  for (ValueMapType::const_iterator I = Map.begin(),
-         E = Map.end(); I != E; ++I) {
-
-    const Value *V = I->first;
-    if (V->hasName())
-      OS << "Value: " << V->getName();
-    else
-      OS << "Value: [null]\n";
-    V->dump();
-
-    OS << " Uses(" << std::distance(V->use_begin(),V->use_end()) << "):";
-    for (Value::const_use_iterator UI = V->use_begin(), UE = V->use_end();
-         UI != UE; ++UI) {
-      if (UI != V->use_begin())
-        OS << ",";
-      if((*UI)->hasName())
-        OS << " " << (*UI)->getName();
-      else
-        OS << " [null]";
-
-    }
-    OS <<  "\n\n";
-  }
-}
-
 // Optimize constant ordering.
 namespace {
   struct CstSortPredicate {
@@ -323,6 +283,10 @@
   if (const Constant *C = dyn_cast<Constant>(V)) {
     if (isa<GlobalValue>(C)) {
       // Initializers for globals are handled explicitly elsewhere.
+    //} else if (isa<ConstantArray>(C) && cast<ConstantArray>(C)->isString()) {
+      // Do not enumerate the initializers for an array of simple characters.
+      // The initializers just pollute the value table, and we emit the strings
+      // specially.
     } else if (C->getNumOperands()) {
       // If a constant has operands, enumerate them.  This makes sure that if a
       // constant has uses (for example an array of const ints), that they are
@@ -342,16 +306,6 @@
       Values.push_back(std::make_pair(V, 1U));
       ValueMap[V] = Values.size();
       return;
-    } else if (const ConstantDataSequential *CDS =
-               dyn_cast<ConstantDataSequential>(C)) {
-      // For our legacy handling of the new ConstantDataSequential type, we
-      // need to enumerate the individual elements, as well as mark the
-      // outer constant as used.
-      for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i)
-        EnumerateValue(CDS->getElementAsConstant(i));
-      Values.push_back(std::make_pair(V, 1U));
-      ValueMap[V] = Values.size();
-      return;
     }
   }
 
@@ -538,4 +492,3 @@
   return getGlobalBasicBlockID(BB);
 }
 
-} // end llvm_2_9 namespace
diff --git a/BitWriter_2_9/ValueEnumerator.h b/BitWriter_2_9/ValueEnumerator.h
index 9e21775..b6fc920 100644
--- a/BitWriter_2_9/ValueEnumerator.h
+++ b/BitWriter_2_9/ValueEnumerator.h
@@ -32,45 +32,40 @@
 class AttrListPtr;
 class ValueSymbolTable;
 class MDSymbolTable;
-class raw_ostream;
-
-}  // end llvm namespace
-
-namespace llvm_2_9 {
 
 class ValueEnumerator {
 public:
-  typedef std::vector<llvm::Type*> TypeList;
+  typedef std::vector<Type*> TypeList;
 
   // For each value, we remember its Value* and occurrence frequency.
-  typedef std::vector<std::pair<const llvm::Value*, unsigned> > ValueList;
+  typedef std::vector<std::pair<const Value*, unsigned> > ValueList;
 private:
-  typedef llvm::DenseMap<llvm::Type*, unsigned> TypeMapType;
+  typedef DenseMap<Type*, unsigned> TypeMapType;
   TypeMapType TypeMap;
   TypeList Types;
 
-  typedef llvm::DenseMap<const llvm::Value*, unsigned> ValueMapType;
+  typedef DenseMap<const Value*, unsigned> ValueMapType;
   ValueMapType ValueMap;
   ValueList Values;
   ValueList MDValues;
-  llvm::SmallVector<const llvm::MDNode *, 8> FunctionLocalMDs;
+  SmallVector<const MDNode *, 8> FunctionLocalMDs;
   ValueMapType MDValueMap;
   
-  typedef llvm::DenseMap<void*, unsigned> AttributeMapType;
+  typedef DenseMap<void*, unsigned> AttributeMapType;
   AttributeMapType AttributeMap;
-  std::vector<llvm::AttrListPtr> Attributes;
+  std::vector<AttrListPtr> Attributes;
   
   /// GlobalBasicBlockIDs - This map memoizes the basic block ID's referenced by
   /// the "getGlobalBasicBlockID" method.
-  mutable llvm::DenseMap<const llvm::BasicBlock*, unsigned> GlobalBasicBlockIDs;
+  mutable DenseMap<const BasicBlock*, unsigned> GlobalBasicBlockIDs;
   
-  typedef llvm::DenseMap<const llvm::Instruction*, unsigned> InstructionMapType;
+  typedef DenseMap<const Instruction*, unsigned> InstructionMapType;
   InstructionMapType InstructionMap;
   unsigned InstructionCount;
 
   /// BasicBlocks - This contains all the basic blocks for the currently
   /// incorporated function.  Their reverse mapping is stored in ValueMap.
-  std::vector<const llvm::BasicBlock*> BasicBlocks;
+  std::vector<const BasicBlock*> BasicBlocks;
   
   /// When a function is incorporated, this is the size of the Values list
   /// before incorporation.
@@ -86,23 +81,20 @@
   ValueEnumerator(const ValueEnumerator &);  // DO NOT IMPLEMENT
   void operator=(const ValueEnumerator &);   // DO NOT IMPLEMENT
 public:
-  ValueEnumerator(const llvm::Module *M);
+  ValueEnumerator(const Module *M);
 
-  void dump() const;
-  void print(llvm::raw_ostream &OS, const ValueMapType &Map, const char *Name) const;
+  unsigned getValueID(const Value *V) const;
 
-  unsigned getValueID(const llvm::Value *V) const;
-
-  unsigned getTypeID(llvm::Type *T) const {
+  unsigned getTypeID(Type *T) const {
     TypeMapType::const_iterator I = TypeMap.find(T);
     assert(I != TypeMap.end() && "Type not in ValueEnumerator!");
     return I->second-1;
   }
 
-  unsigned getInstructionID(const llvm::Instruction *I) const;
-  void setInstructionID(const llvm::Instruction *I);
+  unsigned getInstructionID(const Instruction *I) const;
+  void setInstructionID(const Instruction *I);
 
-  unsigned getAttributeID(const llvm::AttrListPtr &PAL) const {
+  unsigned getAttributeID(const AttrListPtr &PAL) const {
     if (PAL.isEmpty()) return 0;  // Null maps to zero.
     AttributeMapType::const_iterator I = AttributeMap.find(PAL.getRawPointer());
     assert(I != AttributeMap.end() && "Attribute not in ValueEnumerator!");
@@ -118,44 +110,44 @@
   
   const ValueList &getValues() const { return Values; }
   const ValueList &getMDValues() const { return MDValues; }
-  const llvm::SmallVector<const llvm::MDNode *, 8> &getFunctionLocalMDValues() const { 
+  const SmallVector<const MDNode *, 8> &getFunctionLocalMDValues() const { 
     return FunctionLocalMDs;
   }
   const TypeList &getTypes() const { return Types; }
-  const std::vector<const llvm::BasicBlock*> &getBasicBlocks() const {
+  const std::vector<const BasicBlock*> &getBasicBlocks() const {
     return BasicBlocks; 
   }
-  const std::vector<llvm::AttrListPtr> &getAttributes() const {
+  const std::vector<AttrListPtr> &getAttributes() const {
     return Attributes;
   }
   
   /// getGlobalBasicBlockID - This returns the function-specific ID for the
   /// specified basic block.  This is relatively expensive information, so it
   /// should only be used by rare constructs such as address-of-label.
-  unsigned getGlobalBasicBlockID(const llvm::BasicBlock *BB) const;
+  unsigned getGlobalBasicBlockID(const BasicBlock *BB) const;
 
   /// incorporateFunction/purgeFunction - If you'd like to deal with a function,
   /// use these two methods to get its data into the ValueEnumerator!
   ///
-  void incorporateFunction(const llvm::Function &F);
+  void incorporateFunction(const Function &F);
   void purgeFunction();
 
 private:
   void OptimizeConstants(unsigned CstStart, unsigned CstEnd);
     
-  void EnumerateMDNodeOperands(const llvm::MDNode *N);
-  void EnumerateMetadata(const llvm::Value *MD);
-  void EnumerateFunctionLocalMetadata(const llvm::MDNode *N);
-  void EnumerateNamedMDNode(const llvm::NamedMDNode *NMD);
-  void EnumerateValue(const llvm::Value *V);
-  void EnumerateType(llvm::Type *T);
-  void EnumerateOperandType(const llvm::Value *V);
-  void EnumerateAttributes(const llvm::AttrListPtr &PAL);
+  void EnumerateMDNodeOperands(const MDNode *N);
+  void EnumerateMetadata(const Value *MD);
+  void EnumerateFunctionLocalMetadata(const MDNode *N);
+  void EnumerateNamedMDNode(const NamedMDNode *NMD);
+  void EnumerateValue(const Value *V);
+  void EnumerateType(Type *T);
+  void EnumerateOperandType(const Value *V);
+  void EnumerateAttributes(const AttrListPtr &PAL);
   
-  void EnumerateValueSymbolTable(const llvm::ValueSymbolTable &ST);
-  void EnumerateNamedMetadata(const llvm::Module *M);
+  void EnumerateValueSymbolTable(const ValueSymbolTable &ST);
+  void EnumerateNamedMetadata(const Module *M);
 };
 
-}  // end llvm_2_9 namespace
+} // End llvm namespace
 
 #endif
diff --git a/BitWriter_2_9_func/BitcodeWriter.cpp b/BitWriter_2_9_func/BitcodeWriter.cpp
index 9a37aab..9a224ea 100644
--- a/BitWriter_2_9_func/BitcodeWriter.cpp
+++ b/BitWriter_2_9_func/BitcodeWriter.cpp
@@ -154,7 +154,7 @@
 }
 
 // Emit information about parameter attributes.
-static void WriteAttributeTable(const llvm_2_9_func::ValueEnumerator &VE,
+static void WriteAttributeTable(const ValueEnumerator &VE,
                                 BitstreamWriter &Stream) {
   const std::vector<AttrListPtr> &Attrs = VE.getAttributes();
   if (Attrs.empty()) return;
@@ -189,9 +189,8 @@
 }
 
 /// WriteTypeTable - Write out the type table for a module.
-static void WriteTypeTable(const llvm_2_9_func::ValueEnumerator &VE,
-                           BitstreamWriter &Stream) {
-  const llvm_2_9_func::ValueEnumerator::TypeList &TypeList = VE.getTypes();
+static void WriteTypeTable(const ValueEnumerator &VE, BitstreamWriter &Stream) {
+  const ValueEnumerator::TypeList &TypeList = VE.getTypes();
 
   Stream.EnterSubblock(bitc::TYPE_BLOCK_ID_NEW, 4 /*count from # abbrevs */);
   SmallVector<uint64_t, 64> TypeVals;
@@ -383,8 +382,7 @@
 
 // Emit top-level description of module, including target triple, inline asm,
 // descriptors for global variables, and function prototype info.
-static void WriteModuleInfo(const Module *M,
-                            const llvm_2_9_func::ValueEnumerator &VE,
+static void WriteModuleInfo(const Module *M, const ValueEnumerator &VE,
                             BitstreamWriter &Stream) {
   // Emit the list of dependent libraries for the Module.
   for (Module::lib_iterator I = M->lib_begin(), E = M->lib_end(); I != E; ++I)
@@ -552,7 +550,7 @@
 }
 
 static void WriteMDNode(const MDNode *N,
-                        const llvm_2_9_func::ValueEnumerator &VE,
+                        const ValueEnumerator &VE,
                         BitstreamWriter &Stream,
                         SmallVector<uint64_t, 64> &Record) {
   for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
@@ -571,9 +569,9 @@
 }
 
 static void WriteModuleMetadata(const Module *M,
-                                const llvm_2_9_func::ValueEnumerator &VE,
+                                const ValueEnumerator &VE,
                                 BitstreamWriter &Stream) {
-  const llvm_2_9_func::ValueEnumerator::ValueList &Vals = VE.getMDValues();
+  const ValueEnumerator::ValueList &Vals = VE.getMDValues();
   bool StartedMetadataBlock = false;
   unsigned MDSAbbrev = 0;
   SmallVector<uint64_t, 64> Record;
@@ -637,7 +635,7 @@
 }
 
 static void WriteFunctionLocalMetadata(const Function &F,
-                                       const llvm_2_9_func::ValueEnumerator &VE,
+                                       const ValueEnumerator &VE,
                                        BitstreamWriter &Stream) {
   bool StartedMetadataBlock = false;
   SmallVector<uint64_t, 64> Record;
@@ -657,7 +655,7 @@
 }
 
 static void WriteMetadataAttachment(const Function &F,
-                                    const llvm_2_9_func::ValueEnumerator &VE,
+                                    const ValueEnumerator &VE,
                                     BitstreamWriter &Stream) {
   Stream.EnterSubblock(bitc::METADATA_ATTACHMENT_ID, 3);
 
@@ -714,7 +712,7 @@
 }
 
 static void WriteConstants(unsigned FirstVal, unsigned LastVal,
-                           const llvm_2_9_func::ValueEnumerator &VE,
+                           const ValueEnumerator &VE,
                            BitstreamWriter &Stream, bool isGlobal) {
   if (FirstVal == LastVal) return;
 
@@ -755,7 +753,7 @@
 
   SmallVector<uint64_t, 64> Record;
 
-  const llvm_2_9_func::ValueEnumerator::ValueList &Vals = VE.getValues();
+  const ValueEnumerator::ValueList &Vals = VE.getValues();
   Type *LastTy = 0;
   for (unsigned i = FirstVal; i != LastVal; ++i) {
     const Value *V = Vals[i].first;
@@ -868,14 +866,25 @@
         AbbrevToUse = CString7Abbrev;
     } else if (const ConstantDataSequential *CDS = 
                   dyn_cast<ConstantDataSequential>(C)) {
-      // We must replace ConstantDataSequential's representation with the
-      // legacy ConstantArray/ConstantVector/ConstantStruct version.
-      // ValueEnumerator is similarly modified to mark the appropriate
-      // Constants as used (so they are emitted).
-      Code = bitc::CST_CODE_AGGREGATE;
-      for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i)
-        Record.push_back(VE.getValueID(CDS->getElementAsConstant(i)));
-      AbbrevToUse = AggregateAbbrev;
+      Code = bitc::CST_CODE_DATA;
+      Type *EltTy = CDS->getType()->getElementType();
+      if (isa<IntegerType>(EltTy)) {
+        for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i)
+          Record.push_back(CDS->getElementAsInteger(i));
+      } else if (EltTy->isFloatTy()) {
+        for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
+          union { float F; uint32_t I; };
+          F = CDS->getElementAsFloat(i);
+          Record.push_back(I);
+        }
+      } else {
+        assert(EltTy->isDoubleTy() && "Unknown ConstantData element type");
+        for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
+          union { double F; uint64_t I; };
+          F = CDS->getElementAsDouble(i);
+          Record.push_back(I);
+        }
+      }
     } else if (isa<ConstantArray>(C) || isa<ConstantStruct>(C) ||
                isa<ConstantVector>(C)) {
       Code = bitc::CST_CODE_AGGREGATE;
@@ -971,9 +980,9 @@
   Stream.ExitBlock();
 }
 
-static void WriteModuleConstants(const llvm_2_9_func::ValueEnumerator &VE,
+static void WriteModuleConstants(const ValueEnumerator &VE,
                                  BitstreamWriter &Stream) {
-  const llvm_2_9_func::ValueEnumerator::ValueList &Vals = VE.getValues();
+  const ValueEnumerator::ValueList &Vals = VE.getValues();
 
   // Find the first constant to emit, which is the first non-globalvalue value.
   // We know globalvalues have been emitted by WriteModuleInfo.
@@ -995,7 +1004,7 @@
 /// type ID.
 static bool PushValueAndType(const Value *V, unsigned InstID,
                              SmallVector<unsigned, 64> &Vals,
-                             llvm_2_9_func::ValueEnumerator &VE) {
+                             ValueEnumerator &VE) {
   unsigned ValID = VE.getValueID(V);
   Vals.push_back(ValID);
   if (ValID >= InstID) {
@@ -1007,8 +1016,7 @@
 
 /// WriteInstruction - Emit an instruction to the specified stream.
 static void WriteInstruction(const Instruction &I, unsigned InstID,
-                             llvm_2_9_func::ValueEnumerator &VE,
-                             BitstreamWriter &Stream,
+                             ValueEnumerator &VE, BitstreamWriter &Stream,
                              SmallVector<unsigned, 64> &Vals) {
   unsigned Code = 0;
   unsigned AbbrevToUse = 0;
@@ -1296,7 +1304,7 @@
 
 // Emit names for globals/functions etc.
 static void WriteValueSymbolTable(const ValueSymbolTable &VST,
-                                  const llvm_2_9_func::ValueEnumerator &VE,
+                                  const ValueEnumerator &VE,
                                   BitstreamWriter &Stream) {
   if (VST.empty()) return;
   Stream.EnterSubblock(bitc::VALUE_SYMTAB_BLOCK_ID, 4);
@@ -1353,7 +1361,7 @@
 }
 
 /// WriteFunction - Emit a function body to the module stream.
-static void WriteFunction(const Function &F, llvm_2_9_func::ValueEnumerator &VE,
+static void WriteFunction(const Function &F, ValueEnumerator &VE,
                           BitstreamWriter &Stream) {
   Stream.EnterSubblock(bitc::FUNCTION_BLOCK_ID, 4);
   VE.incorporateFunction(F);
@@ -1425,8 +1433,7 @@
 }
 
 // Emit blockinfo, which defines the standard abbreviations etc.
-static void WriteBlockInfo(const llvm_2_9_func::ValueEnumerator &VE,
-                           BitstreamWriter &Stream) {
+static void WriteBlockInfo(const ValueEnumerator &VE, BitstreamWriter &Stream) {
   // We only want to emit block info records for blocks that have multiple
   // instances: CONSTANTS_BLOCK, FUNCTION_BLOCK and VALUE_SYMTAB_BLOCK.  Other
   // blocks can defined their abbrevs inline.
@@ -1599,7 +1606,7 @@
   }
 
   // Analyze the module, enumerating globals, functions, etc.
-  llvm_2_9_func::ValueEnumerator VE(M);
+  ValueEnumerator VE(M);
 
   // Emit blockinfo, which defines the standard abbreviations etc.
   WriteBlockInfo(VE, Stream);
diff --git a/BitWriter_2_9_func/ValueEnumerator.cpp b/BitWriter_2_9_func/ValueEnumerator.cpp
index 88c406f..3764dec 100644
--- a/BitWriter_2_9_func/ValueEnumerator.cpp
+++ b/BitWriter_2_9_func/ValueEnumerator.cpp
@@ -19,13 +19,9 @@
 #include "llvm/Module.h"
 #include "llvm/ValueSymbolTable.h"
 #include "llvm/Instructions.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/Support/raw_ostream.h"
 #include <algorithm>
 using namespace llvm;
 
-namespace llvm_2_9_func {
-
 static bool isIntegerValue(const std::pair<const Value*, unsigned> &V) {
   return V.first->getType()->isIntegerTy();
 }
@@ -111,6 +107,7 @@
   OptimizeConstants(FirstConstant, Values.size());
 }
 
+
 unsigned ValueEnumerator::getInstructionID(const Instruction *Inst) const {
   InstructionMapType::const_iterator I = InstructionMap.find(Inst);
   assert(I != InstructionMap.end() && "Instruction is not mapped!");
@@ -133,43 +130,6 @@
   return I->second-1;
 }
 
-void ValueEnumerator::dump() const {
-  print(dbgs(), ValueMap, "Default");
-  dbgs() << '\n';
-  print(dbgs(), MDValueMap, "MetaData");
-  dbgs() << '\n';
-}
-
-void ValueEnumerator::print(raw_ostream &OS, const ValueMapType &Map,
-                            const char *Name) const {
-
-  OS << "Map Name: " << Name << "\n";
-  OS << "Size: " << Map.size() << "\n";
-  for (ValueMapType::const_iterator I = Map.begin(),
-         E = Map.end(); I != E; ++I) {
-
-    const Value *V = I->first;
-    if (V->hasName())
-      OS << "Value: " << V->getName();
-    else
-      OS << "Value: [null]\n";
-    V->dump();
-
-    OS << " Uses(" << std::distance(V->use_begin(),V->use_end()) << "):";
-    for (Value::const_use_iterator UI = V->use_begin(), UE = V->use_end();
-         UI != UE; ++UI) {
-      if (UI != V->use_begin())
-        OS << ",";
-      if((*UI)->hasName())
-        OS << " " << (*UI)->getName();
-      else
-        OS << " [null]";
-
-    }
-    OS <<  "\n\n";
-  }
-}
-
 // Optimize constant ordering.
 namespace {
   struct CstSortPredicate {
@@ -323,6 +283,10 @@
   if (const Constant *C = dyn_cast<Constant>(V)) {
     if (isa<GlobalValue>(C)) {
       // Initializers for globals are handled explicitly elsewhere.
+    //} else if (isa<ConstantArray>(C) && cast<ConstantArray>(C)->isString()) {
+      // Do not enumerate the initializers for an array of simple characters.
+      // The initializers just pollute the value table, and we emit the strings
+      // specially.
     } else if (C->getNumOperands()) {
       // If a constant has operands, enumerate them.  This makes sure that if a
       // constant has uses (for example an array of const ints), that they are
@@ -342,16 +306,6 @@
       Values.push_back(std::make_pair(V, 1U));
       ValueMap[V] = Values.size();
       return;
-    } else if (const ConstantDataSequential *CDS =
-               dyn_cast<ConstantDataSequential>(C)) {
-      // For our legacy handling of the new ConstantDataSequential type, we
-      // need to enumerate the individual elements, as well as mark the
-      // outer constant as used.
-      for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i)
-        EnumerateValue(CDS->getElementAsConstant(i));
-      Values.push_back(std::make_pair(V, 1U));
-      ValueMap[V] = Values.size();
-      return;
     }
   }
 
@@ -538,4 +492,3 @@
   return getGlobalBasicBlockID(BB);
 }
 
-}  // end llvm_2_9_func namespace
diff --git a/BitWriter_2_9_func/ValueEnumerator.h b/BitWriter_2_9_func/ValueEnumerator.h
index bfcc8da..b6fc920 100644
--- a/BitWriter_2_9_func/ValueEnumerator.h
+++ b/BitWriter_2_9_func/ValueEnumerator.h
@@ -32,45 +32,40 @@
 class AttrListPtr;
 class ValueSymbolTable;
 class MDSymbolTable;
-class raw_ostream;
-
-}  // end llvm namespace
-
-namespace llvm_2_9_func {
 
 class ValueEnumerator {
 public:
-  typedef std::vector<llvm::Type*> TypeList;
+  typedef std::vector<Type*> TypeList;
 
   // For each value, we remember its Value* and occurrence frequency.
-  typedef std::vector<std::pair<const llvm::Value*, unsigned> > ValueList;
+  typedef std::vector<std::pair<const Value*, unsigned> > ValueList;
 private:
-  typedef llvm::DenseMap<llvm::Type*, unsigned> TypeMapType;
+  typedef DenseMap<Type*, unsigned> TypeMapType;
   TypeMapType TypeMap;
   TypeList Types;
 
-  typedef llvm::DenseMap<const llvm::Value*, unsigned> ValueMapType;
+  typedef DenseMap<const Value*, unsigned> ValueMapType;
   ValueMapType ValueMap;
   ValueList Values;
   ValueList MDValues;
-  llvm::SmallVector<const llvm::MDNode *, 8> FunctionLocalMDs;
+  SmallVector<const MDNode *, 8> FunctionLocalMDs;
   ValueMapType MDValueMap;
   
-  typedef llvm::DenseMap<void*, unsigned> AttributeMapType;
+  typedef DenseMap<void*, unsigned> AttributeMapType;
   AttributeMapType AttributeMap;
-  std::vector<llvm::AttrListPtr> Attributes;
+  std::vector<AttrListPtr> Attributes;
   
   /// GlobalBasicBlockIDs - This map memoizes the basic block ID's referenced by
   /// the "getGlobalBasicBlockID" method.
-  mutable llvm::DenseMap<const llvm::BasicBlock*, unsigned> GlobalBasicBlockIDs;
+  mutable DenseMap<const BasicBlock*, unsigned> GlobalBasicBlockIDs;
   
-  typedef llvm::DenseMap<const llvm::Instruction*, unsigned> InstructionMapType;
+  typedef DenseMap<const Instruction*, unsigned> InstructionMapType;
   InstructionMapType InstructionMap;
   unsigned InstructionCount;
 
   /// BasicBlocks - This contains all the basic blocks for the currently
   /// incorporated function.  Their reverse mapping is stored in ValueMap.
-  std::vector<const llvm::BasicBlock*> BasicBlocks;
+  std::vector<const BasicBlock*> BasicBlocks;
   
   /// When a function is incorporated, this is the size of the Values list
   /// before incorporation.
@@ -86,23 +81,20 @@
   ValueEnumerator(const ValueEnumerator &);  // DO NOT IMPLEMENT
   void operator=(const ValueEnumerator &);   // DO NOT IMPLEMENT
 public:
-  ValueEnumerator(const llvm::Module *M);
+  ValueEnumerator(const Module *M);
 
-  void dump() const;
-  void print(llvm::raw_ostream &OS, const ValueMapType &Map, const char *Name) const;
+  unsigned getValueID(const Value *V) const;
 
-  unsigned getValueID(const llvm::Value *V) const;
-
-  unsigned getTypeID(llvm::Type *T) const {
+  unsigned getTypeID(Type *T) const {
     TypeMapType::const_iterator I = TypeMap.find(T);
     assert(I != TypeMap.end() && "Type not in ValueEnumerator!");
     return I->second-1;
   }
 
-  unsigned getInstructionID(const llvm::Instruction *I) const;
-  void setInstructionID(const llvm::Instruction *I);
+  unsigned getInstructionID(const Instruction *I) const;
+  void setInstructionID(const Instruction *I);
 
-  unsigned getAttributeID(const llvm::AttrListPtr &PAL) const {
+  unsigned getAttributeID(const AttrListPtr &PAL) const {
     if (PAL.isEmpty()) return 0;  // Null maps to zero.
     AttributeMapType::const_iterator I = AttributeMap.find(PAL.getRawPointer());
     assert(I != AttributeMap.end() && "Attribute not in ValueEnumerator!");
@@ -118,44 +110,44 @@
   
   const ValueList &getValues() const { return Values; }
   const ValueList &getMDValues() const { return MDValues; }
-  const llvm::SmallVector<const llvm::MDNode *, 8> &getFunctionLocalMDValues() const { 
+  const SmallVector<const MDNode *, 8> &getFunctionLocalMDValues() const { 
     return FunctionLocalMDs;
   }
   const TypeList &getTypes() const { return Types; }
-  const std::vector<const llvm::BasicBlock*> &getBasicBlocks() const {
+  const std::vector<const BasicBlock*> &getBasicBlocks() const {
     return BasicBlocks; 
   }
-  const std::vector<llvm::AttrListPtr> &getAttributes() const {
+  const std::vector<AttrListPtr> &getAttributes() const {
     return Attributes;
   }
   
   /// getGlobalBasicBlockID - This returns the function-specific ID for the
   /// specified basic block.  This is relatively expensive information, so it
   /// should only be used by rare constructs such as address-of-label.
-  unsigned getGlobalBasicBlockID(const llvm::BasicBlock *BB) const;
+  unsigned getGlobalBasicBlockID(const BasicBlock *BB) const;
 
   /// incorporateFunction/purgeFunction - If you'd like to deal with a function,
   /// use these two methods to get its data into the ValueEnumerator!
   ///
-  void incorporateFunction(const llvm::Function &F);
+  void incorporateFunction(const Function &F);
   void purgeFunction();
 
 private:
   void OptimizeConstants(unsigned CstStart, unsigned CstEnd);
     
-  void EnumerateMDNodeOperands(const llvm::MDNode *N);
-  void EnumerateMetadata(const llvm::Value *MD);
-  void EnumerateFunctionLocalMetadata(const llvm::MDNode *N);
-  void EnumerateNamedMDNode(const llvm::NamedMDNode *NMD);
-  void EnumerateValue(const llvm::Value *V);
-  void EnumerateType(llvm::Type *T);
-  void EnumerateOperandType(const llvm::Value *V);
-  void EnumerateAttributes(const llvm::AttrListPtr &PAL);
+  void EnumerateMDNodeOperands(const MDNode *N);
+  void EnumerateMetadata(const Value *MD);
+  void EnumerateFunctionLocalMetadata(const MDNode *N);
+  void EnumerateNamedMDNode(const NamedMDNode *NMD);
+  void EnumerateValue(const Value *V);
+  void EnumerateType(Type *T);
+  void EnumerateOperandType(const Value *V);
+  void EnumerateAttributes(const AttrListPtr &PAL);
   
-  void EnumerateValueSymbolTable(const llvm::ValueSymbolTable &ST);
-  void EnumerateNamedMetadata(const llvm::Module *M);
+  void EnumerateValueSymbolTable(const ValueSymbolTable &ST);
+  void EnumerateNamedMetadata(const Module *M);
 };
 
-}  // End llvm_2_9_func namespace
+} // End llvm namespace
 
 #endif
diff --git a/slang_version.h b/slang_version.h
index 07bd337..ef390ea 100644
--- a/slang_version.h
+++ b/slang_version.h
@@ -41,8 +41,7 @@
 enum {
   LEGACY = 0,
   ICS = 1400,
-  JB = 1600,
-  CURRENT = JB
+  CURRENT = ICS
 };
 }  // namespace SlangVersion