[PATCH] D31924: SROA: Allow eliminating addrspacecasted allocas

David Chisnall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 01:32:39 PDT 2017


theraven added a comment.

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.

This change still has the problem with requiring bijection between address spaces, which is not the case for us or for any platform where there is a subset relationship between address spaces.  For example, casting from a 32-bit address to a 16-bit address and then back is not guaranteed to give the same address.  On an ARM M-profile chip, casting between addresses in different MPU sections may encounter similar problems.

I'm very nervous of any optimisations that introduce address space casts, because they rely on far more knowledge of the relationship between address spaces than we currently provide with the data layout.  Perhaps providing that information in the data layout should be a prerequisite for this.


https://reviews.llvm.org/D31924





More information about the llvm-commits mailing list