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

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 13:03:02 PDT 2023


jdoerfert added a comment.

We can get this in such that we only modify accesses first. However, we need to rewrite other pointers (arguments, phi's, geps, ...) in a follow up as that can save registers.



================
Comment at: llvm/include/llvm/Transforms/IPO/Attributor.h:1514
+                                bool ChangeDroppable = true,
+                                bool AllowDuplicates = false) {
     auto &Entry = ToBeChangedValues[&V];
----------------
This is not a good idea.


================
Comment at: llvm/include/llvm/Transforms/IPO/Attributor.h:4870
+  AAAddressSpaceInfo(const IRPosition &IRP, Attributor &A)
+      : StateWrapper<IncIntegerState<uint32_t>, AbstractAttribute>(IRP) {}
+
----------------
I don't think we want an inc state. It is really just <no-AS/dead, AS-X, unknown>


================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:9923
+    bool UsedAssumedInformation = false;
+    if (!AA::getAssumedUnderlyingObjects(A, getAssociatedValue(), Objects, *this,
+                                    getCtxI(), UsedAssumedInformation))
----------------
This is now AAUnderlyingValues


================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:9965-9983
+      const IRPosition &InstPos = IRPosition::inst(*cast<Instruction>(U));
+      bool UsedAssumedInformation = false;
+      auto &LivenessAA =
+          A.getAAFor<AAIsDead>(*this, InstPos, DepClassTy::REQUIRED);
+      if (A.isAssumedDead(InstPos, this, &LivenessAA, UsedAssumedInformation))
+        continue;
+
----------------
We can just replace all uses with the casted pointer, no need for pretty much all of this.


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