[DAG] Ensure vector constant folding uses correct scalar undef types
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 17 Oct 2015 16:49:43 +0000 (16:49 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 17 Oct 2015 16:49:43 +0000 (16:49 +0000)
Minor fix to D13665 found during post-commit review.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250616 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 2ff20774eae41e4d26a1620eba7760ea37559789..6d613436b8f377599e4d7d43a2ffb46ecbe1ef2a 100644 (file)
@@ -3321,11 +3321,11 @@ SDValue SelectionDAG::FoldConstantVectorArithmetic(unsigned Opcode, SDLoc DL,
   for (unsigned i = 0; i != NumElts; i++) {
     SmallVector<SDValue, 4> ScalarOps;
     for (SDValue Op : Ops) {
-      EVT InSVT = Op->getValueType(0).getScalarType();
+      EVT InSVT = Op.getValueType().getScalarType();
       BuildVectorSDNode *InBV = dyn_cast<BuildVectorSDNode>(Op);
       if (!InBV) {
         // We've checked that this is UNDEF above.
-        ScalarOps.push_back(getUNDEF(LegalSVT));
+        ScalarOps.push_back(getUNDEF(InSVT));
         continue;
       }