shiltian wrote: > This is the wrong place to handle this. AMDGPUCodeGenPrepare cannot be used for lowering. Then I wonder what `AMDGPUCodeGenPrepareImpl::visitAddrSpaceCastInst` is? https://github.com/llvm/llvm-project/pull/136584