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

Vidush Singhal via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 16:51:57 PDT 2024


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

…rough user

>From 9030b041faec3e980f36cea09100e6416ed676ec Mon Sep 17 00:00:00 2001
From: Vidush Singhal <singhal2 at ruby964.llnl.gov>
Date: Tue, 4 Jun 2024 16:51:06 -0700
Subject: [PATCH] [Attributor]: AApointerinfo, allow more than one offset for a
 pass through user

---
 llvm/lib/Transforms/IPO/AttributorAttributes.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

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;
   };



More information about the llvm-commits mailing list