]> granicus.if.org Git - llvm/commitdiff
[SelectionDAG] NFC patch removing a redundant check.
authorJonas Paulsson <paulsson@linux.vnet.ibm.com>
Thu, 6 Apr 2017 13:00:37 +0000 (13:00 +0000)
committerJonas Paulsson <paulsson@linux.vnet.ibm.com>
Thu, 6 Apr 2017 13:00:37 +0000 (13:00 +0000)
Since the BUILD_VECTOR has already been checked by
isBuildVectorOfConstantSDNodes() in SelectionDAG::getNode() for a
SIGN_EXTEND_INREG, it can be assumed that Op is always either undef or a
ConstantSDNode, and Ops.size() will always equal VT.getVectorNumElements().

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

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 163458096fd416784a2af60e4fd31dca2eb9ebd6..003ea5030bfce21241550e0da29349732c61815c 100644 (file)
@@ -4208,15 +4208,11 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
           Ops.push_back(getUNDEF(OpVT));
           continue;
         }
-        if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op)) {
-          APInt Val = C->getAPIntValue();
-          Ops.push_back(SignExtendInReg(Val, OpVT));
-          continue;
-        }
-        break;
+        ConstantSDNode *C = cast<ConstantSDNode>(Op);
+        APInt Val = C->getAPIntValue();
+        Ops.push_back(SignExtendInReg(Val, OpVT));
       }
-      if (Ops.size() == VT.getVectorNumElements())
-        return getBuildVector(VT, DL, Ops);
+      return getBuildVector(VT, DL, Ops);
     }
     break;
   }