- 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.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
llvm/lib/Transforms/Scalar/SROA.cpp | ||
---|---|---|
1706–1713 | 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 | |
1784 | Isn't there a create-noop or create reinterpret cast somewhere? This also probably needs more comments |
llvm/lib/Transforms/Scalar/SROA.cpp | ||
---|---|---|
1784 | so far, there is no cast creating that pair. |
llvm/lib/Transforms/Scalar/SROA.cpp | ||
---|---|---|
1709 | good point |
LGTM with one minor comment
llvm/lib/Transforms/Scalar/SROA.cpp | ||
---|---|---|
1709 | I think "different non-integral" is backwards from the code? |
Do you need to check isNonIntegralPointerType()?