PATCH: SelectionDAG: Fix incorrect lowering of CONCAT_VECTOR

Tom Stellard tom at stellard.net
Thu Aug 7 08:40:34 PDT 2014


Hi,

Here is an updated patch with a small fix.  We still need to
use the element type of the input node when its operands are
scalar, because when we have a build vector with inputs
larger than the element size of the node, their values will
be truncated when stored to memory.

-Tom

On Thu, Aug 07, 2014 at 07:57:14AM -0700, Tom Stellard wrote:
> Hi,
> 
> SelectionDAGLegalize::ExpandVectorBuildThroughStack() was being
> used to expand CONCAT_VECTORS, but it was assuming that its inputs
> would only be BUILD_VECTOR nodes, so it was using the element type
> of the input node to calculate the offsets for storing values to
> the stack.  For example:
>     
> v16f32 = concat_vectors v8f32, v8f32
> 
> With this node, it would compute the offset as sizeof(f32),
> so it would store the first operand at FrameIndex + 0 and the
> second operand at FrameIndex + 4.  What it should be doing
> for concat_vectors is using the value type of the operands
> to compute the offset.  The second operand should be stored
> at FrameIndex + sizeof(v8f32).
>     
> R600 currently hits this code path, however it should really be
> be custom lowering CONCAT_VECTORS instead of expanding them since
> this will produce much better code.  There are no testscase, because
> no other in-tree targets seem to hit this path, and I don't think
> there is much value in adding a test to R600, since I'm going
> to modify it to custom lower CONCAT_VECTORS real soon.
> 
> -Tom

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-SelectionDAG-Fix-incorrect-lowering-of-CONCAT_VECTOR.patch
Type: text/x-diff
Size: 3544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140807/cb7f505d/attachment.patch>


More information about the llvm-commits mailing list