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

via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 02:35:51 PDT 2024


================
@@ -0,0 +1,48 @@
+; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes=instcombine %s | FileCheck %s
+
+; Variant of select with addrspacecast in one branch on path to root alloca (ic opt is then disabled)
----------------
jofrn wrote:

Yes, it crashes. During PtrReplacer, a replacement operand for the select of the branch without an addrspacecast is not found, leading to a crash when creating the replacement select itself (the unfound operand will be null and passed into create of select).

The operand's replacement is not found because PtrReplacer is destructive, and so once the select is reached, there are no longer references to the old instructions. Instead of the original argument on the path from the alloca, the argument of the IR function is used as the operand to the select. This argument is not an instruction, so the WorkMap returns 0 for it.

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


More information about the llvm-commits mailing list