Improve EXTRACT_VECTOR_ELT patch based on comments from Duncan
llvm-svn: 95012
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 6729a93..10487da 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/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;
}