- When promoting a pointer from memory to register, SROA skips pointers from different address spaces. However, as ptrtoint and inttoptr are defined as no-op casts if that integer type has the same as the pointer value, generate the pair of ptrtoint/inttoptr (no-op cast) sequence to convert pointers from different address spaces if they have the same size.
cast<PointerType>->getPointerAddressSpace is redundant. You can drop the pionter in the getter. Also, in this case I would probably prefer dyn_cast and check the pointer since this is immediately after an isPointerTy check
Isn't there a create-noop or create reinterpret cast somewhere?
This also probably needs more comments