Add a missing check, which broke a bunch of vector tests.
authorChris Lattner <sabre@nondot.org>
Mon, 3 Apr 2006 17:21:50 +0000 (17:21 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 3 Apr 2006 17:21:50 +0000 (17:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27374 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index 5742aef684210c836542f1a74338e4dfbddc9533..aacee99ed9936865a6b3b77a2824e3693275496a 100644 (file)
@@ -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();