[llvm] r193252 - X86: Make concat_vectors combine a bit more conservative.

Nadav Rotem nrotem at apple.com
Wed Oct 23 11:04:55 PDT 2013


Hi Jim, 

Thanks for fixing the bug. Do you have a test ?   

My main concern was that this optimization is not X86 specific (and surly not SSE specific).  Optimizing concat_vectors into scalar-to-vector is something that all targets can benefit from. 

Thanks,
Nadav



On Oct 23, 2013, at 10:37 AM, Jim Grosbach <grosbach at apple.com> wrote:

> Author: grosbach
> Date: Wed Oct 23 12:37:40 2013
> New Revision: 193252
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=193252&view=rev
> Log:
> X86: Make concat_vectors combine a bit more conservative.
> 
> Per Nadav's review comments for r192866.
> 
> Modified:
>    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
> 
> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=193252&r1=193251&r2=193252&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Oct 23 12:37:40 2013
> @@ -16188,6 +16188,8 @@ static SDValue PerformConcatCombine(SDNo
>       Op0->getOpcode() == ISD::BITCAST &&
>       !TLI.isTypeLegal(Op0->getValueType(0)) &&
>       TLI.isTypeLegal(Op0->getOperand(0)->getValueType(0))) {
> +    if (Op0->getOperand(0)->getValueType(0).isVector())
> +      return SDValue();
>     SDValue Scalar = Op0->getOperand(0);
>     // Any legal type here will be a simple value type.
>     MVT SVT = Scalar->getValueType(0).getSimpleVT();
> @@ -16195,6 +16197,10 @@ static SDValue PerformConcatCombine(SDNo
>     if (SVT == MVT::x86mmx)
>       return SDValue();
>     EVT NVT = MVT::getVectorVT(SVT, 2);
> +    // If the result vector type isn't legal, this transform won't really
> +    // help, so bail on that, too.
> +    if (!TLI.isTypeLegal(NVT))
> +      return SDValue();
>     SDLoc dl = SDLoc(N);
>     SDValue Res = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, NVT, Scalar);
>     Res = DAG.getNode(ISD::BITCAST, dl, VT, Res);
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list