Fix MDString Abbrev setup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78034 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp
index 00b1d00..1e6e9fb 100644
--- a/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -504,10 +504,6 @@
         
         LastBlockID = bitc::METADATA_BLOCK_ID;
         Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3);
-      }
-    }
-    if (const MDString *MDS = dyn_cast<MDString>(V)) {
-      if (MDSAbbrev == 0) {
         // Abbrev for METADATA_STRING.
         BitCodeAbbrev *Abbv = new BitCodeAbbrev();
         Abbv->Add(BitCodeAbbrevOp(bitc::METADATA_STRING));
@@ -515,6 +511,8 @@
         Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 8));
         MDSAbbrev = Stream.EmitAbbrev(Abbv);
       }
+    }
+    if (const MDString *MDS = dyn_cast<MDString>(V)) {
       // Code: [strchar x N]
       const char *StrBegin = MDS->begin();
       for (unsigned i = 0, e = MDS->length(); i != e; ++i)