[llvm] [InstCombine][AMDGPU] Disable PtrReplacer when select has mismatch AS. (PR #98456)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 07:22:29 PDT 2024


================
@@ -280,6 +282,34 @@ class PointerReplacer {
 };
 } // end anonymous namespace
 
+/// Return true iff Op is an addrspacecast whose source addrspace
+/// is that of the root.
+bool PointerReplacer::foundASC(const Value *Op) const {
+  if (auto *ASC = dyn_cast<AddrSpaceCastInst>(Op)) {
+    auto SelectOpAS = ASC->getSrcAddressSpace();
+    auto AllocaAS = Root.getType()->getPointerAddressSpace();
+    auto FoundASC = SelectOpAS == AllocaAS;
----------------
arsenm wrote:

No auto. Also don't need FoundASC variable 

https://github.com/llvm/llvm-project/pull/98456


More information about the llvm-commits mailing list