[PATCH] D120586: [Attributor] Add AAAddressSpaceInfo to deduce address spaces

Shilei Tian via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 6 20:23:02 PDT 2023


tianshilei1992 added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:11923-11924
+    auto Pred = [&](const Use &U, bool &) {
+      if (U.get() != AssociatedValue)
+        return true;
+      User *Usr = U.getUser();
----------------
jdoerfert wrote:
> Why check this? What can check is if the pointer is actually an AS cast we can just "undo".
Because the doc of the function `checkForAllUses` says:
> Check \p Pred on all (transitive) uses of \p V.

We only want direct uses of the value here, so we check if the use is the value itself. Did I get it wrong?


================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:11979-11981
+    Type *NewPtrTy = PointerType::getWithSamePointeeType(
+        cast<PointerType>(getAssociatedType()), AS);
+    Instruction *CastInst = new AddrSpaceCastInst(AssociatedValue, NewPtrTy);
----------------
arsenm wrote:
> Doesn't consider vector of pointers 
Hmm, vector of pointers or pointer of vector?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120586/new/

https://reviews.llvm.org/D120586



More information about the llvm-commits mailing list