OSDN Git Service

[DAGCombiner] Use DAG.getAnyExtOrTrunc to simplify some code. NFC
authorCraig Topper <craig.topper@gmail.com>
Sat, 4 Feb 2017 23:26:37 +0000 (23:26 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sat, 4 Feb 2017 23:26:37 +0000 (23:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294109 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index 8a85feb..d38a9fc 100644 (file)
@@ -12828,11 +12828,7 @@ SDValue DAGCombiner::visitINSERT_VECTOR_ELT(SDNode *N) {
     // All the operands of BUILD_VECTOR must have the same type;
     // we enforce that here.
     EVT OpVT = Ops[0].getValueType();
-    if (InVal.getValueType() != OpVT)
-      InVal = OpVT.bitsGT(InVal.getValueType()) ?
-                DAG.getNode(ISD::ANY_EXTEND, DL, OpVT, InVal) :
-                DAG.getNode(ISD::TRUNCATE, DL, OpVT, InVal);
-    Ops[Elt] = InVal;
+    Ops[Elt] = OpVT.isInteger() ? DAG.getAnyExtOrTrunc(InVal, DL, OpVT) : InVal;
   }
 
   // Return the new vector