[PATCH] D81938: [SROA] Teach SROA to perform no-op pointer conversion.[InferAddressSpaces] Handle the pair of `ptrtoint`/`inttoptr`.

Michael Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 16 07:42:48 PDT 2020


hliao created this revision.
hliao added reviewers: arsenm, chandlerc.
Herald added subscribers: llvm-commits, cfe-commits, kerbowa, hiraditya, nhaehnle, wdng, jvesely.
Herald added projects: clang, LLVM.

- 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.

- `ptrtoint` and `inttoptr` are defined as no-op casts if the integer value as the same size as the pointer value. The pair of `ptrtoint`/`inttoptr` is in fact a no-op cast sequence between different address spaces. Teach `infer-address-spaces` to handle them like a `bitcast`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81938

Files:
  clang/test/CodeGenCUDA/amdgpu-kernel-arg-pointer-type.cu
  llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/test/Transforms/InferAddressSpaces/noop-ptrint-pair.ll
  llvm/test/Transforms/SROA/address-spaces.ll
  llvm/test/Transforms/SROA/alloca-address-space.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81938.271084.patch
Type: text/x-patch
Size: 18040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200616/339150a3/attachment-0001.bin>


More information about the cfe-commits mailing list