[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:54:51 PDT 2024


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

>From adbef26292f33a2606ace306889ce692f37a9300 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 | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 1b3bf3c732ed0..836bc89897e59 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -1607,11 +1607,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