[llvm] b7d6324 - IntrinsicEmitter: Change IntrinsicsToAttributesMap from uint8_t[] to uint16_t[]

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 27 20:34:42 PST 2021


Author: Fangrui Song
Date: 2021-01-27T20:34:35-08:00
New Revision: b7d63244226ba2c0df651622fe7fe3f5f8aba262

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

LOG: IntrinsicEmitter: Change IntrinsicsToAttributesMap from uint8_t[] to uint16_t[]

We need at least 252 UniqAttributes now, which will soon overflow.
Actually with downstream backends we can easily use up the last few values.
So bump to uint16_t.

Added: 
    

Modified: 
    llvm/utils/TableGen/IntrinsicEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/IntrinsicEmitter.cpp b/llvm/utils/TableGen/IntrinsicEmitter.cpp
index 4be0d90a45d2..978d24c8300d 100644
--- a/llvm/utils/TableGen/IntrinsicEmitter.cpp
+++ b/llvm/utils/TableGen/IntrinsicEmitter.cpp
@@ -638,13 +638,13 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
       std::max(maxArgAttrs, unsigned(intrinsic.ArgumentAttributes.size()));
     unsigned &N = UniqAttributes[&intrinsic];
     if (N) continue;
-    assert(AttrNum < 256 && "Too many unique attributes for table!");
     N = ++AttrNum;
+    assert(N < 65536 && "Too many unique attributes for table!");
   }
 
   // Emit an array of AttributeList.  Most intrinsics will have at least one
   // entry, for the function itself (index ~1), which is usually nounwind.
-  OS << "  static const uint8_t IntrinsicsToAttributesMap[] = {\n";
+  OS << "  static const uint16_t IntrinsicsToAttributesMap[] = {\n";
 
   for (unsigned i = 0, e = Ints.size(); i != e; ++i) {
     const CodeGenIntrinsic &intrinsic = Ints[i];


        


More information about the llvm-commits mailing list