From 04c00fc844cfd3cb7df176d8251371ac5d0d7f2e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 3 Apr 2006 17:21:50 +0000 Subject: Add a missing check, which broke a bunch of vector tests. llvm-svn: 27374 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 5742aef6842..aacee99ed99 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2756,9 +2756,12 @@ SDOperand DAGCombiner::visitVBinOp(SDNode *N, ISD::NodeType IntOp, Ops.back().getOpcode() == ISD::ConstantFP) && "Scalar binop didn't fold!"); } - Ops.push_back(*(LHS.Val->op_end()-2)); - Ops.push_back(*(LHS.Val->op_end()-1)); - return DAG.getNode(ISD::VBUILD_VECTOR, MVT::Vector, Ops); + + if (Ops.size() == LHS.getNumOperands()-2) { + Ops.push_back(*(LHS.Val->op_end()-2)); + Ops.push_back(*(LHS.Val->op_end()-1)); + return DAG.getNode(ISD::VBUILD_VECTOR, MVT::Vector, Ops); + } } return SDOperand(); -- cgit v1.2.3