[llvm] [Attributor]: AApointerinfo, allow more than one offset for a pass th… (PR #94416)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 16:52:30 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Vidush Singhal (vidsinghal)

<details>
<summary>Changes</summary>

…rough user

---
Full diff: https://github.com/llvm/llvm-project/pull/94416.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+10-1) 


``````````diff
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 1b3bf3c732ed0..8a722802fa58e 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -75,6 +75,7 @@
 #include <numeric>
 #include <optional>
 #include <string>
+#include <utility>
 
 using namespace llvm;
 
@@ -1607,11 +1608,19 @@ ChangeStatus AAPointerInfoFloating::updateImpl(Attributor &A) {
     //
     // The RHS is a reference that may be invalidated by an insertion caused by
     // the LHS. So we ensure that the side-effect of the LHS happens first.
+
+    if (!OffsetInfoMap.contains(Usr)) {
+      auto &PtrOI = OffsetInfoMap[CurPtr];
+      OffsetInfoMap.insert(std::make_pair(Usr, PtrOI));
+      Follow = true;
+      return true;
+    }
+
     auto &UsrOI = OffsetInfoMap[Usr];
     auto &PtrOI = OffsetInfoMap[CurPtr];
     assert(!PtrOI.isUnassigned() &&
            "Cannot pass through if the input Ptr was not visited!");
-    UsrOI = PtrOI;
+    UsrOI.merge(PtrOI);
     Follow = true;
     return true;
   };

``````````

</details>


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


More information about the llvm-commits mailing list