[llvm] [NVPTX] instcombine known pointer AS checks. (PR #112964)
Artem Belevich via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 24 17:03:25 PDT 2024
================
@@ -6365,6 +6367,34 @@ static Value *simplifyUnaryIntrinsic(Function *F, Value *Op0,
break;
}
+ case Intrinsic::nvvm_isspacep_global:
+ case Intrinsic::nvvm_isspacep_local:
+ case Intrinsic::nvvm_isspacep_shared:
+ case Intrinsic::nvvm_isspacep_const: {
+ auto *Ty = F->getReturnType();
+ unsigned AS = Op0->getType()->getPointerAddressSpace();
+ if (AS == NVPTXAS::ADDRESS_SPACE_GENERIC) {
+ if (auto *ASC = dyn_cast<AddrSpaceCastInst>(Op0))
----------------
Artem-B wrote:
I think that's handled by the `ConstantExpr` below.
At least, that's what handles `ptr addrspacecast (ptr addrspace(3) @shared_data to ptr)` in the tests.
I guess casting directly to `AddrSpaceCastOperator` would avoid explicit comparison of the opcode with `Instruction::AddrSpaceCast`.
https://github.com/llvm/llvm-project/pull/112964
More information about the llvm-commits
mailing list