[llvm] Add the 'initializes' attribute langref and support (PR #84803)

Jan Voung via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 07:20:04 PDT 2024


================
@@ -2332,6 +2335,25 @@ Error BitcodeReader::parseAttributeGroupBlock() {
           i--;
 
           B.addConstantRangeAttr(Kind, MaybeCR.get());
+        } else if (Record[i] == 8) {
+          Attribute::AttrKind Kind;
+          if (Error Err = parseAttrKind(Record[++i], &Kind))
+            return Err;
+          if (!Attribute::isConstantRangeListAttrKind(Kind))
+            return error("Not a constant range list attribute");
+
+          SmallVector<ConstantRange, 2> Val;
+          unsigned RangeSize = Record[++i];
+          unsigned BitWidth = Record[++i];
+          if (i + 2 * RangeSize >= e)
+            return error("Incomplete constant range list");
+          for (unsigned Idx = 0; Idx < RangeSize; ++Idx) {
+            int64_t Start = BitcodeReader::decodeSignRotatedValue(Record[++i]);
----------------
jvoung wrote:

The `int64_t` as type would still assume BitWidth <= 64.
 
Can you factor out part of readConstantRange() and reuse that (the part after having read the BitWidth from the record)?

https://github.com/llvm/llvm-project/pull/84803


More information about the llvm-commits mailing list