[llvm] r230278 - Fix based on post-commit comment on D7816 & rL230177 - BUILD_VECTOR operand truncation was using the the BV's output scalar type instead of the input type.

Aditya Nandakumar aditya_nandakumar at apple.com
Mon Feb 23 17:15:56 PST 2015


Hi Simon

MinVT is initialized to VT.getScalarType() which we can’t assume to be legal.
If that type happens to be illegal, and is smaller than OpSVT, then we would end up with illegal type (MinVT = MinVT.bitsLE(OpSVT) ? MinVT : OpSVT;).

Aditya
> On Feb 23, 2015, at 3:04 PM, Simon Pilgrim <llvm-dev at redking.me.uk> wrote:
> 
> Author: rksimon
> Date: Mon Feb 23 17:04:28 2015
> New Revision: 230278
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=230278&view=rev
> Log:
> Fix based on post-commit comment on D7816 & rL230177 - BUILD_VECTOR operand truncation was using the the BV's output scalar type instead of the input type.
> 
> Modified:
>    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
> 
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=230278&r1=230277&r2=230278&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Feb 23 17:04:28 2015
> @@ -11447,10 +11447,11 @@ SDValue DAGCombiner::visitCONCAT_VECTORS
>     if (!SVT.isFloatingPoint())
>       // If BUILD_VECTOR are from built from integer, they may have different
>       // operand types. Get the smaller type and truncate all operands to it.
> -      for (const SDValue &Op : N->ops()) {
> -        EVT OpSVT = Op.getValueType().getScalarType();
> -        MinVT = MinVT.bitsLE(OpSVT) ? MinVT : OpSVT;
> -      }
> +      for (const SDValue &Op : N->ops())
> +        if (ISD::BUILD_VECTOR == Op.getOpcode()) {
> +          EVT OpSVT = Op.getOperand(0)->getValueType(0);
> +          MinVT = MinVT.bitsLE(OpSVT) ? MinVT : OpSVT;
> +        }
> 
>     for (const SDValue &Op : N->ops()) {
>       EVT OpVT = Op.getValueType();
> 
> 
> _______________________________________________
> 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