[llvm] [Attributor]: allow more than one offset for a pass through user in AAPointerInfo (PR #94416)

Vidush Singhal via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 5 10:42:38 PDT 2024


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

>From e1e27af86611206ff745d044b54f0269a53cce44 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 9a5732dca5b79..471cf4190cbd9 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -1607,11 +1607,20 @@ 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 &UsrOI = OffsetInfoMap[Usr];
+      auto &PtrOI = OffsetInfoMap[CurPtr];
+      UsrOI = 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