Commit missed files from nocapture change.
[oota-llvm.git] / lib / Bitcode / Reader / BitcodeReader.cpp
index f06c61de41594bfb1e8cb2142f1c67742f6ea2d9..2d994d4b13d03d71bab25d111a0d0e2bfacec3b5 100644 (file)
@@ -362,6 +362,20 @@ bool BitcodeReader::ParseAttributeBlock() {
       Attributes RetAttribute = Attribute::None;
       Attributes FnAttribute = Attribute::None;
       for (unsigned i = 0, e = Record.size(); i != e; i += 2) {
+        // FIXME: remove in LLVM 3.0
+        // The alignment is stored as a 16-bit raw value from bits 31--16.
+        // We shift the bits above 31 down by 11 bits.
+
+        unsigned Alignment = (Record[i+1] & (0xffffull << 16)) >> 16;
+        if (Alignment && !isPowerOf2_32(Alignment))
+          return Error("Alignment is not a power of two.");
+
+        Attributes ReconstitutedAttr = Record[i+1] & 0xffff;
+        if (Alignment)
+          ReconstitutedAttr |= Attribute::constructAlignmentFromInt(Alignment);
+        ReconstitutedAttr |= (Record[i+1] & (0xffffull << 32)) >> 11;
+        Record[i+1] = ReconstitutedAttr;
+
         if (Record[i] == 0)
           RetAttribute = Record[i+1];
         else if (Record[i] == ~0U)