[PATCH] D31924: SROA: Allow eliminating addrspacecasted allocas

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 09:45:36 PDT 2017


sanjoy added a comment.

In https://reviews.llvm.org/D31924#754613, @theraven wrote:

> There was some discussion about non-integral address spaces at EuroLLVM.  The current restriction is too great, as not allowing ptrtoint and inttoptr makes it impossible to support C-like languages.  We discussed refining the definition to be that optimisers should not introduce inttoptr or ptrtoint, but that they are allowed to be inserted by the front end in places where they are valid in the context of the source language.


You're making me regret not making it to EuroLLVM even more. :)

We disallowed `ptrtoint` and `inttoptr` because these instructions (today) are arbitrarily speculatable; and changing that to be dependent on their types would introduce complexity.

Instead my plan is to add intrinsics to convert between ni pointers and integers with exactly the property you mentioned -- these intrinsics may have side effects so they can't be inserted by the optimizer or speculated, but the frontend may insert them when legal.


https://reviews.llvm.org/D31924





More information about the llvm-commits mailing list