[PATCH] D135158: [DataLayout] Introduce DataLayout::getPointerIntegralSize(AS)

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 4 14:22:58 PDT 2022


arichardson added a comment.

In D135158#3834627 <https://reviews.llvm.org/D135158#3834627>, @nikic wrote:

> Is this needed for anything but the one usage in D99660 <https://reviews.llvm.org/D99660>? We could just stop using ptrtoint there and just explicitly check for the nullptr and inttoptr cases, which is all this handles in practice. This overly general constant expression based code has already caused enough complications in the past, so I'm happy to drop it.
>
> I don't think producing a ptr2int out of thin air (without a known result type) is common, and should probably be avoided in general. The main case where we currently introduce ptr2int is when type punning through memory, and in that case the load/store type determines the used type.

There are also a few other cases where code wants needs the address range instead of the pointer size but that does not matter for most targets. I'll upload a few more patches that show where this function is needed for CHERI.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135158



More information about the llvm-commits mailing list