[llvm] Add the 'initializes' attribute langref and support (PR #84803)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed May 8 18:57:04 PDT 2024
================
@@ -943,11 +946,20 @@ void ModuleBitcodeWriter::writeAttributeGroupTable() {
Record.push_back(getAttrKindEncoding(Attr.getKindAsEnum()));
if (Ty)
Record.push_back(VE.getTypeID(Attr.getValueAsType()));
- } else {
- assert(Attr.isConstantRangeAttribute());
+ } else if (Attr.isConstantRangeAttribute()) {
Record.push_back(7);
Record.push_back(getAttrKindEncoding(Attr.getKindAsEnum()));
emitConstantRange(Record, Attr.getValueAsConstantRange());
+ } else {
+ assert(Attr.isConstantRangeListAttribute());
+ Record.push_back(8);
+ Record.push_back(getAttrKindEncoding(Attr.getKindAsEnum()));
+ ArrayRef<ConstantRange> Val = Attr.getValueAsConstantRangeList();
+ Record.push_back(Val.size());
+ for (auto &CR : Val) {
+ emitSignedInt64(Record, CR.getLower().getSExtValue());
+ emitSignedInt64(Record, CR.getUpper().getSExtValue());
----------------
nikic wrote:
This hardcodes the 64-bit ranges in the bitcode format. We shouldn't do that to allow future uses of this attribute type with different width. This should use emitConstantRange() instead, maybe after a small refactoring to allow emitting the bit width separately (as we don't need to emit it for each range...)
https://github.com/llvm/llvm-project/pull/84803
More information about the llvm-commits
mailing list