[llvm] [Attributor]: AApointerInfo - store the full chain of instructions that make up the access (PR #96526)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 8 08:18:04 PDT 2024


================
@@ -5785,6 +5793,136 @@ struct AAPointerInfo : public AbstractAttribute {
     AK_MUST_READ_WRITE = AK_MUST | AK_R | AK_W,
   };
 
+  /// A helper containing a list of offsets computed for a Use. Ideally this
+  /// list should be strictly ascending, but we ensure that only when we
+  /// actually translate the list of offsets to a RangeList.
+  struct OffsetInfo {
+    using VecTy = SmallVector<AA::RangeTy>;
+    // A map to store depth 1 predecessors per offset.
+    using OriginsTy = SmallVector<SmallPtrSet<Value *, 4>>;
+    using const_iterator = VecTy::const_iterator;
+    OriginsTy Origins;
+    VecTy Ranges;
+
+    const_iterator begin() const { return Ranges.begin(); }
+    const_iterator end() const { return Ranges.end(); }
+
+    bool operator==(const OffsetInfo &RHS) const {
+      return Ranges == RHS.Ranges && Origins == RHS.Origins;
+    }
+
+    bool operator!=(const OffsetInfo &RHS) const { return !(*this == RHS); }
+
+    void insert(AA::RangeTy Range, Value &V) {
+
----------------
shiltian wrote:

```suggestion
```

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


More information about the llvm-commits mailing list