Skip to content

Commit 9b681ea

Browse files
authored
[IntrinsicEmitter] Make AttributesMap bound inclusive (#158714)
This is a minor fix from comment https://github.com/llvm/llvm-project/pull/157965/files#r2347317186 introduced in #157965.
1 parent 5399aa1 commit 9b681ea

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llvm/test/TableGen/intrinsic-attrs.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def int_deref_ptr_ret : Intrinsic<[llvm_ptr_ty], [], [Dereferenceable<RetIndex,
2525
// CHECK-NEXT: });
2626

2727
// CHECK: static constexpr uint16_t IntrinsicsToAttributesMap[] = {
28-
// CHECK: 0 << 2 | 0, // llvm.deref.ptr.ret
29-
// CHECK: 1 << 2 | 1, // llvm.random.gen
28+
// CHECK: 0 << 1 | 0, // llvm.deref.ptr.ret
29+
// CHECK: 1 << 1 | 1, // llvm.random.gen
3030
// CHECK: }; // IntrinsicsToAttributesMap
3131

3232
// CHECK: static constexpr ArgNoAttrIDPair ArgAttrIdTable[] = {

llvm/utils/TableGen/Basic/IntrinsicEmitter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,10 +629,10 @@ static constexpr uint16_t IntrinsicsToAttributesMap[] = {)";
629629
UniqAttributes.try_emplace(&Int, ID);
630630
}
631631

632-
const uint8_t UniqAttributesBitSize = Log2_32_Ceil(UniqAttributes.size() + 1);
632+
const uint8_t UniqAttributesBitSize = Log2_32_Ceil(UniqAttributes.size());
633633
// Note, ID `-1` is used to indicate no function attributes.
634634
const uint8_t UniqFnAttributesBitSize =
635-
Log2_32_Ceil(UniqFnAttributes.size() + 2);
635+
Log2_32_Ceil(UniqFnAttributes.size() + 1);
636636
const uint16_t NoFunctionAttrsID =
637637
maskTrailingOnes<uint16_t>(UniqFnAttributesBitSize);
638638
if (UniqAttributesBitSize + UniqFnAttributesBitSize > 16)

0 commit comments

Comments
 (0)