From fdeb9fe5e08146d9cb953000cb893eda80329a08 Mon Sep 17 00:00:00 2001 From: Stepan Dyatkovskiy Date: Wed, 22 Aug 2012 09:33:55 +0000 Subject: [PATCH] Rejected 169195. As Duncan commented, bitcasting to proper type is wrong approach. We need to insert some valid TRANCATE node here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162354 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 26 +++--------------------- test/CodeGen/ARM/crash-shufflevector.ll | 10 --------- 2 files changed, 3 insertions(+), 33 deletions(-) delete mode 100644 test/CodeGen/ARM/crash-shufflevector.ll diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 1c485a01fe7..4e29879bef1 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -7876,29 +7876,9 @@ SDValue DAGCombiner::visitBUILD_VECTOR(SDNode *N) { if (VecIn1.getValueType().getSizeInBits()*2 != VT.getSizeInBits()) return SDValue(); - // If the element type of the input vector is not the same as - // the output element type, make concat_vectors based on input element - // type and then bitcast it to the output vector type. - // - // In another words avoid nodes like this: - // v16i8 = concat_vectors v4i16 v4i16 - // Replace it with this one: - // v8i16 = concat_vectors v4i16 v4i16 - // v16i8 = bitcast NODE0 - EVT ItemType = VecIn1.getValueType().getVectorElementType(); - if (ItemType != VT.getVectorElementType()) { - EVT ConcatVT = EVT::getVectorVT(*DAG.getContext(), - ItemType, - VecIn1.getValueType().getVectorNumElements()*2); - // Widen the input vector by adding undef values. - VecIn1 = DAG.getNode(ISD::CONCAT_VECTORS, dl, ConcatVT, - VecIn1, DAG.getUNDEF(VecIn1.getValueType())); - VecIn1 = DAG.getNode(ISD::BITCAST, dl, VT, VecIn1); - } else - // Widen the input vector by adding undef values. - VecIn1 = DAG.getNode(ISD::CONCAT_VECTORS, dl, VT, - VecIn1, DAG.getUNDEF(VecIn1.getValueType())); - + // Widen the input vector by adding undef values. + VecIn1 = DAG.getNode(ISD::CONCAT_VECTORS, N->getDebugLoc(), VT, + VecIn1, DAG.getUNDEF(VecIn1.getValueType())); } // If VecIn2 is unused then change it to undef. diff --git a/test/CodeGen/ARM/crash-shufflevector.ll b/test/CodeGen/ARM/crash-shufflevector.ll deleted file mode 100644 index ece4234699d..00000000000 --- a/test/CodeGen/ARM/crash-shufflevector.ll +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: llc < %s -mtriple=armv7-- - -declare void @g(<16 x i8>) -define void @f(<4 x i8> %param1, <4 x i8> %param2) { - %y1 = shufflevector <4 x i8> %param1, <4 x i8> undef, <16 x i32> - %y2 = shufflevector <4 x i8> %param2, <4 x i8> undef, <16 x i32> - %z = shufflevector <16 x i8> %y1, <16 x i8> %y2, <16 x i32> - call void @g(<16 x i8> %z) - ret void -}