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

Shilei Tian via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 18:12:21 PDT 2023


tianshilei1992 added inline comments.


================
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;
----------------
jdoerfert wrote:
> tianshilei1992 wrote:
> > jdoerfert wrote:
> > > 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.
> > Why does the AS of value operand matter here?
> because the verifier might not like us replacing the value `ptr %p` with `ptr addrspace(3) %q`. Make a test with that patter, if it passes, we are A-OK.
I tested the following case and it works:
```
define internal void @_Z13unknown_writePi(ptr addrspace(1) noundef %p) #0 {
entry:
  store ptr addrspace(1) %p, ptr addrspace(1) %p, align 4
  ret void
}
```


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