[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:39:16 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;
----------------
jofrn wrote:

HasASC is marked as a preprocess step before running hasConflictingAS, which can be run without checking HasASC; but if the path from the select to the root does not have an addrspacecast, then hasConflictingAS does not have to be run as no addrspacecast will be found via foundASC.

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


More information about the llvm-commits mailing list