[PATCH] D147025: [InstCombine] Teach alloca replacement to handle `addrspacecast`

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 3 07:02:46 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/include/llvm/Analysis/TargetTransformInfoImpl.h:99
+  bool isValidAddrSpaceCast(unsigned FromAS, unsigned ToAS) const {
+    return FromAS == ToAS;
+  }
----------------
The langref/verifier do not allow addrspacecast between the same address space 


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h:173-179
+      switch (FromAS) {
+      case AMDGPUAS::GLOBAL_ADDRESS:
+      case AMDGPUAS::CONSTANT_ADDRESS:
+      case AMDGPUAS::LOCAL_ADDRESS:
+      case AMDGPUAS::PRIVATE_ADDRESS:
+        return true;
+      default:
----------------
This misses a variety of valid casts. More or less anything except region should be a valid to flat case. Also the constant_32bit can cast to constant and to flat.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147025



More information about the llvm-commits mailing list