[PATCH] [X86] Skip concat_vectors when lowering vector broadcast

Robert Lougher rob.lougher at gmail.com
Wed Dec 11 13:21:51 PST 2013

[Sending to list as I forgot to reply to all]

Hi Nadav,

On 11 December 2013 21:01, Nadav Rotem <nrotem at apple.com> wrote:
> Hi Robert,
> Thanks for working on this.  I am okay with your patch but I prefer that we canonicalize the code below:
> %2 = v4f32 BUILD_VECTOR %1, %1, %1, %1
> %3 = v8f32 concat_vectors %2, undef
> %4 = v8f32 vector_shuffle %3, undef, <0,0,0,0,0,0,0,0>
> into either a single BUILD_VECTOR or a broadcast vector_shuffle.  This should happen as a DAGCombine optimization any time before operation legalization.

Yes, that was my alternative (handle it in DAGCombiner::visitCONCAT_
VECTORS).  My fear was that the general combine could get quite
complex and as I'm new to LLVM I'd get stuck.  Would it be acceptable
to add a simple combine that just handled the case above in the first


> Thanks,
> Nadav

More information about the llvm-commits mailing list