[llvm] [IntrinsicEmitter] Make AttributesMap bits adaptive (PR #157965)
Elvin Wang via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 15 10:09:28 PDT 2025
================
@@ -629,21 +629,24 @@ static constexpr uint16_t IntrinsicsToAttributesMap[] = {)";
UniqAttributes.try_emplace(&Int, ID);
}
- constexpr uint16_t NoFunctionAttrsID = 255;
- if (UniqAttributes.size() > 256)
- PrintFatalError("Too many unique argument attributes for table!");
- // Note, ID 255 is used to indicate no function attributes.
- if (UniqFnAttributes.size() > 255)
- PrintFatalError("Too many unique function attributes for table!");
-
- // Assign a 16-bit packed ID for each intrinsic. The lower 8-bits will be its
- // "argument attribute ID" (index in UniqAttributes) and upper 8 bits will be
+ const uint8_t UniqAttributesBitSize = Log2_32_Ceil(UniqAttributes.size() + 1);
----------------
elvinw-intel wrote:
> @elvinw-intel why is the +1 needed here? Assuming UniqAttributes.size() == 256, we should be able to use 8 bits, but it seems here it will use 9 bits.
yes that is incorrect and need to be fixed - I can add the fix in follow up or create a new draft.
https://github.com/llvm/llvm-project/pull/157965
More information about the llvm-commits
mailing list