From 9fc0e7c1aaab29691bc628607d6e8701e522d7b6 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 30 Apr 2020 18:45:04 +0200 Subject: [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. --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 9bdac5c4..f36dab3 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)); -- cgit v1.1