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

Haopeng Liu via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 10:23:47 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]);
----------------
haopliu wrote:

Refactored `readConstantRange` and reused it to avoid the bitwidth assumption. Thanks!

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


More information about the llvm-commits mailing list