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

Haopeng Liu via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 15:03:35 PDT 2024


================
@@ -222,6 +241,37 @@ class ConstantRangeAttributeImpl : public EnumAttributeImpl {
   const ConstantRange &getConstantRangeValue() const { return CR; }
 };
 
+class ConstantRangeListAttributeImpl final
+    : public EnumAttributeImpl,
+      private TrailingObjects<ConstantRangeListAttributeImpl, ConstantRange> {
+  friend TrailingObjects;
+
+  unsigned Size;
+  size_t numTrailingObjects(OverloadToken<ConstantRange>) const { return Size; }
+
+public:
+  ConstantRangeListAttributeImpl(Attribute::AttrKind Kind,
+                                 ArrayRef<ConstantRange> Val)
+      : EnumAttributeImpl(ConstantRangeListAttrEntry, Kind), Size(Val.size()) {
+    ConstantRange *TrailingCR = getTrailingObjects<ConstantRange>();
+    assert(Size > 0);
+    unsigned BitWidth = Val.front().getLower().getBitWidth();
+    for (unsigned I = 0; I != Size; ++I) {
+      assert(BitWidth == Val[I].getLower().getBitWidth());
+      new (&TrailingCR[I]) ConstantRange(BitWidth, false);
----------------
haopliu wrote:

Removed this code snippet.

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


More information about the llvm-commits mailing list