From: Tom Stellard Date: Thu, 23 Apr 2015 22:59:24 +0000 (+0000) Subject: R600: Correctly lower CONCAT_VECTOR nodes with more than 2 operands X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=6d49b023a4a7a018c631d635ec34b40872af417d;p=oota-llvm.git R600: Correctly lower CONCAT_VECTOR nodes with more than 2 operands git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235662 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/R600/AMDGPUISelLowering.cpp b/lib/Target/R600/AMDGPUISelLowering.cpp index 7c5235d1507..c99f222d783 100644 --- a/lib/Target/R600/AMDGPUISelLowering.cpp +++ b/lib/Target/R600/AMDGPUISelLowering.cpp @@ -839,11 +839,9 @@ SDValue AMDGPUTargetLowering::LowerGlobalAddress(AMDGPUMachineFunction* MFI, SDValue AMDGPUTargetLowering::LowerCONCAT_VECTORS(SDValue Op, SelectionDAG &DAG) const { SmallVector Args; - SDValue A = Op.getOperand(0); - SDValue B = Op.getOperand(1); - DAG.ExtractVectorElements(A, Args); - DAG.ExtractVectorElements(B, Args); + for (const SDUse &U : Op->ops()) + DAG.ExtractVectorElements(U.get(), Args); return DAG.getNode(ISD::BUILD_VECTOR, SDLoc(Op), Op.getValueType(), Args); } diff --git a/test/CodeGen/R600/concat_vectors.ll b/test/CodeGen/R600/concat_vectors.ll index 6b3fae384db..a09ed1f7385 100644 --- a/test/CodeGen/R600/concat_vectors.ll +++ b/test/CodeGen/R600/concat_vectors.ll @@ -283,3 +283,14 @@ define void @test_concat_v16i16(<32 x i16> addrspace(1)* %out, <16 x i16> %a, <1 store <32 x i16> %concat, <32 x i16> addrspace(1)* %out, align 64 ret void } + +; FUNC-LABEL: {{^}}concat_vector_crash: +; SI: s_endpgm +define void @concat_vector_crash(<8 x float> addrspace(1)* %out, <2 x float> addrspace(1)* %in) { +bb: + %tmp = load <2 x float>, <2 x float> addrspace(1)* %in, align 4 + %tmp1 = shufflevector <2 x float> %tmp, <2 x float> undef, <8 x i32> + %tmp2 = shufflevector <8 x float> undef, <8 x float> %tmp1, <8 x i32> + store <8 x float> %tmp2, <8 x float> addrspace(1)* %out, align 32 + ret void +}