[PATCH] D64146: [ConstExprPreter][WIP] Initial patch for the constexpr interpreter

JF Bastien via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 11:08:00 PDT 2019

jfb added a comment.

In D64146#1604717 <https://reviews.llvm.org/D64146#1604717>, @nand wrote:

> > How do you intend to represent pointers cast to integer types? Allocating 64 bits of state for a 64-bit integer is insufficient to model that case.
> Is this ever going to be allowed in constexpr? If that is the case, we'll add a separate type for all integers which are large enough to hold a pointer, a tagged union indicating whether the value is a number or a pointer. This would add significant overhead, but I don't see any other way which can correctly diagnose UB when casting a random integer to a pointer.

Most integers won't be in that category, you can therefore speculate that fact when emitting bytecode, and throw away byte code when the assumption turns out to be wrong (and re-generate the more expensive byte code).

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list