[llvm] [GlobalISel] Constant-fold G_PTR_ADD with different type sizes (PR #81473)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 04:53:37 PST 2024


Pierre-vh wrote:

Depends on the operation, if you have `G_PTR_ADD` then you can directly increment the pointer.
If you `G_PTRTOINT` first you can use `G_ADD` but then you need the type of the LHS and RHS to match, so you need to ext/trunc as needed.
For `G_PTR_ADD` it's like a GEP so you can use a different type for the offset.

https://github.com/llvm/llvm-project/pull/81473


More information about the llvm-commits mailing list