[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:25:56 PDT 2024


================
@@ -926,10 +933,101 @@ struct AA::PointerInfo::State : public AbstractState {
   BooleanState BS;
 };
 
+AAPointerInfo::Access::AccessPathSetTy *
+AA::PointerInfo::State::findAllAccessPaths(
+    AAPointerInfo::OffsetInfoMapTy &OffsetInfoMap, Instruction *LocalI) {
+
+  AAPointerInfo::Access::AccessPathSetTy *AccessPathsSet =
+      new AAPointerInfo::Access::AccessPathSetTy();
+
+  // Store the instruction and its storage (i.e, which path it belongs to)
+  // on the stack.
+  // We also store the visited map on the stack.
+  // Since we want to find new paths, we want to make sure an instruction is
+  // not visited twice on the same path. However, we can visit the same
+  // instruction more that once if it exists on different paths.
+  SmallVector<std::tuple<Value *, AAPointerInfo::Access::AccessPathTy *,
+                         SmallPtrSet<Value *, 4>>,
+              16>
+      Stack;
+
+  // Populate the stack with elements.
+  for (auto *It = LocalI->op_begin(); It != LocalI->op_end(); It++) {
+
----------------
shiltian wrote:

```suggestion
```

I don't think LLVM has the requirement of a blank line at the beginning of any code block. Also, looking at the code base, there are not many cases. I'd prefer to not have a blank line.

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


More information about the llvm-commits mailing list