[llvm] 9fc0e7c - [BitcodeReader] Simplify raw attribute handling (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 09:47:31 PDT 2020


Author: Nikita Popov
Date: 2020-04-30T18:47:14+02:00
New Revision: 9fc0e7c1aaab29691bc628607d6e8701e522d7b6

URL: https://github.com/llvm/llvm-project/commit/9fc0e7c1aaab29691bc628607d6e8701e522d7b6
DIFF: https://github.com/llvm/llvm-project/commit/9fc0e7c1aaab29691bc628607d6e8701e522d7b6.diff

LOG: [BitcodeReader] Simplify raw attribute handling (NFC)

Every new attribute we add from now on will not be supported in the
raw format, because we ran out of space. Don't bother listing each
affected attribute twice.

Added: 
    

Modified: 
    llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 9bdac5c471a9..f36dab3c9f74 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1284,28 +1284,10 @@ static uint64_t getRawAttributeMask(Attribute::AttrKind Val) {
     return 1ULL << 62;
   case Attribute::NoFree:
     return 1ULL << 63;
-  case Attribute::NoSync:
-    llvm_unreachable("nosync attribute not supported in raw format");
-    break;
-  case Attribute::Dereferenceable:
-    llvm_unreachable("dereferenceable attribute not supported in raw format");
-    break;
-  case Attribute::DereferenceableOrNull:
-    llvm_unreachable("dereferenceable_or_null attribute not supported in raw "
-                     "format");
-    break;
-  case Attribute::ArgMemOnly:
-    llvm_unreachable("argmemonly attribute not supported in raw format");
-    break;
-  case Attribute::AllocSize:
-    llvm_unreachable("allocsize not supported in raw format");
-    break;
-  case Attribute::SanitizeMemTag:
-    llvm_unreachable("sanitize_memtag attribute not supported in raw format");
-    break;
-  case Attribute::Preallocated:
-    llvm_unreachable("preallocated attribute not supported in raw format");
-    break;
+  default:
+    // Other attributes are not supported in the raw format,
+    // as we ran out of space.
+    return 0;
   }
   llvm_unreachable("Unsupported attribute type");
 }
@@ -1315,11 +1297,6 @@ static void addRawAttributeValue(AttrBuilder &B, uint64_t Val) {
 
   for (Attribute::AttrKind I = Attribute::None; I != Attribute::EndAttrKinds;
        I = Attribute::AttrKind(I + 1)) {
-    if (I == Attribute::SanitizeMemTag || I == Attribute::Dereferenceable ||
-        I == Attribute::DereferenceableOrNull || I == Attribute::ArgMemOnly ||
-        I == Attribute::AllocSize || I == Attribute::NoSync ||
-        I == Attribute::Preallocated)
-      continue;
     if (uint64_t A = (Val & getRawAttributeMask(I))) {
       if (I == Attribute::Alignment)
         B.addAlignmentAttr(1ULL << ((A >> 16) - 1));


        


More information about the llvm-commits mailing list