[DAGCombiner] Simplify some code in visitBITCAST. NFCI
authorCraig Topper <craig.topper@intel.com>
Sat, 22 Sep 2018 23:12:34 +0000 (23:12 +0000)
committerCraig Topper <craig.topper@intel.com>
Sat, 22 Sep 2018 23:12:34 +0000 (23:12 +0000)
llvm-svn: 342826

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index 0493fde..6d19f22 100644 (file)
@@ -9841,15 +9841,9 @@ SDValue DAGCombiner::visitBITCAST(SDNode *N) {
   // First check to see if this is all constant.
   if (!LegalTypes &&
       N0.getOpcode() == ISD::BUILD_VECTOR && N0.getNode()->hasOneUse() &&
-      VT.isVector()) {
-    bool isSimple = cast<BuildVectorSDNode>(N0)->isConstant();
-
-    EVT DestEltVT = N->getValueType(0).getVectorElementType();
-    assert(!DestEltVT.isVector() &&
-           "Element type of vector ValueType must not be vector!");
-    if (isSimple)
-      return ConstantFoldBITCASTofBUILD_VECTOR(N0.getNode(), DestEltVT);
-  }
+      VT.isVector() && cast<BuildVectorSDNode>(N0)->isConstant())
+    return ConstantFoldBITCASTofBUILD_VECTOR(N0.getNode(),
+                                             VT.getVectorElementType());
 
   // If the input is a constant, let getNode fold it.
   if (isa<ConstantSDNode>(N0) || isa<ConstantFPSDNode>(N0)) {