[PATCH] D120586: [Attributor] Add AAAddressSpace to deduce address spaces
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 10 10:39:17 PDT 2023
jdoerfert added inline comments.
================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:12046
+ auto *AUO = A.getOrCreateAAFor<AAUnderlyingObjects>(getIRPosition(), this,
+ DepClassTy::OPTIONAL);
+ auto Pred = [&](Value &Obj) {
----------------
================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:12077-12078
+ Value *NewV = nullptr;
+ if (OriginalValue->getType()->getPointerAddressSpace() ==
+ static_cast<uint32_t>(getAddressSpace())) {
+ NewV = OriginalValue;
----------------
Hoist this.
================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:12104-12105
+ if (auto *SI = dyn_cast<StoreInst>(Inst))
+ if (SI->getPointerOperand() == AssociatedValue) {
+ MakeChange(Inst, const_cast<Use &>(U));
+ return true;
----------------
This doesn't actually help as it does not filter `store ptr %p, ptr %p`. Again, if we can just change both uses, then let's do so. If the verifier is unhappy, check that the use `U` is the pointer operand.
================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:12133-12134
+
+ bool takeAddressSpace(uint32_t AS) {
+ int32_t Cast = static_cast<int32_t>(AS);
+ if (AssumedAddressSpace == NoAddressSpace) {
----------------
================
Comment at: llvm/test/Transforms/Attributor/address_space_info.ll:9
+ at s2 = dso_local addrspace(3) global i32 undef, align 4
+ at llvm.compiler.used = appending global [3 x ptr] [ptr addrspacecast (ptr addrspace(1) @dst to ptr), ptr addrspacecast (ptr addrspace(1) @g1 to ptr), ptr addrspacecast (ptr addrspace(1) @g2 to ptr)], section "llvm.metadata"
+
----------------
remove the compiler used part
================
Comment at: llvm/test/Transforms/Attributor/address_space_info.ll:108
+}
+
+; Function Attrs: convergent mustprogress noinline nounwind
----------------
================
Comment at: llvm/test/Transforms/Attributor/value-simplify.ll:804
+; TUNIT-NEXT: [[TMP1:%.*]] = addrspacecast ptr addrspacecast (ptr addrspace(3) @ConstAS3Ptr to ptr) to ptr addrspace(3)
+; TUNIT-NEXT: store i32 0, ptr addrspace(3) [[TMP1]], align 4
; TUNIT-NEXT: ret void
----------------
tianshilei1992 wrote:
> This should be replaced by `@ConstAS3Ptr` directly.
Did you update the test, above it seems to work.
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