[PATCH] D143945: [AMDGPU] Add legalization case for PTR_ADD on buffer pointers

Krzysztof Drewniak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 16 16:25:34 PST 2023


krzysz00 added a comment.

(quick notes from phone)

I'm not convinced you need to store the offset in the actual value of the pointer itself. That is, because addres space 7 is non-integral, the only operations that can modify the address a buffer descriptor points to (uhlees the user really wants to do weird things) are GEPs.

This means that, to get the offset argument to the load operation, all we have to do is trace through the G_PTR_ADD operations and add those together until we reach a G_PTR_ADD input that didn't come from a GEP (ok, there is the complexity that we'd need to replicate comdjtiinaks if we really wanted to do this trace right), take the sum of their offset values that offset value, use it as the offset to the load/store

What worries me about the i160 approach is that it'll mess up things like allocating function arguments: if I want to pass a buffer descriptor to a function, that takes four registers and not five.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143945/new/

https://reviews.llvm.org/D143945



More information about the llvm-commits mailing list