PATCH: SelectionDAG: Use MVT::i32 for vector indices

Nadav Rotem nrotem at apple.com
Fri Jul 26 13:54:36 PDT 2013


Please add a message string to your asserts.  Except for that, LGTM! 


On Jul 26, 2013, at 10:48 AM, Tom Stellard <tom at stellard.net> wrote:

> Hi,
> 
> The attached patch ensures that the SelectionDAG always uses MVT::i32
> for the index operands of EXTRACT_VECTOR_ELT, INSERT_VECTOR_ELT,
> INSERT_SUBVECTOR, and EXTRACT_SUBVECTOR.  MVT::i32 was chosen because
> the LLVM IR specification uses i32 for all its vector instructions that
> take an index arguement.
> 
> The previous code was using TargetLowering::getPointerTy() for vector
> indices.  I think the reason for this was to make it easier to handle
> non-constant vector indices, which required that the vector be
> stored in memory.
> 
> Using TargetLowering::getPointerTy() can be a problem for targets with
> pointer sizes that differ across address spaces, since the address space
> used to store the vector may have a different pointer size than the
> 'zero' address space which is what TargetLowering::getPointerTy() uses.
> 
> There are two motivations for this patch, the first is to clean
> up some bad code that is generated when using dynamic indexing
> of vectors in the R600 target.  The second is to reduce the use of
> TargetLowering::getPointerTy() in the SelectionDAG code which will help
> anyone who is trying to improve support for targets with pointer sizes
> that differ across address spaces.
> 
> Please Review.
> 
> Thanks,
> Tom
> 
> 
> <SelectionDAG-Use-MVT-i32-for-vector-index.patch>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130726/1db90af7/attachment.html>


More information about the llvm-commits mailing list