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

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 23:51:43 PDT 2024


================
@@ -270,16 +270,54 @@ class PointerReplacer {
     unsigned ToAS = ASC->getDestAddressSpace();
     return (FromAS == ToAS) || IC.isValidAddrSpaceCast(FromAS, ToAS);
   }
+  bool foundASC(const Value *Op) const;
+  bool hasConflictingAS(const SelectInst *I) const;
 
   SmallPtrSet<Instruction *, 32> ValuesToRevisit;
+  SmallPtrSet<SelectInst *, 32> ValuesToRevisitAS;
   SmallSetVector<Instruction *, 4> Worklist;
   MapVector<Value *, Value *> WorkMap;
   InstCombinerImpl &IC;
   Instruction &Root;
   unsigned FromAS;
+  bool HasASC = false;
 };
 } // end anonymous namespace
 
+/// Return true iff valid addrspacecast is found on
+/// path from end of branch to root of tree.
+bool PointerReplacer::foundASC(const Value *Op) const {
+  const Instruction *TI;
----------------
jofrn wrote:

Hm, will try this out. It appears to be, so then HasASC is moreso unnecessary since hasConflictingAS will be constant. I'll take a look again. Thank you.

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


More information about the llvm-commits mailing list