Improve EXTRACT_VECTOR_ELT patch based on comments from Duncan


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95012 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 6729a93..10487da 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -5411,10 +5411,7 @@
    EVT NVT = N->getValueType(0);
    if (InOp.getValueType() != NVT) {
      assert(InOp.getValueType().isInteger() && NVT.isInteger());
-     if (NVT.getSizeInBits() > InOp.getValueType().getSizeInBits())
-       return DAG.getNode(ISD::SIGN_EXTEND, InVec.getDebugLoc(), NVT, InOp);
-     else
-       return DAG.getNode(ISD::TRUNCATE, InVec.getDebugLoc(), NVT, InOp);
+     return DAG.getSExtOrTrunc(InOp, InVec.getDebugLoc(), NVT);
    }
    return InOp;
  }