[llvm] r299647 - [SelectionDAG] NFC patch removing a redundant check.

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 6 06:00:37 PDT 2017


Author: jonpa
Date: Thu Apr  6 08:00:37 2017
New Revision: 299647

URL: http://llvm.org/viewvc/llvm-project?rev=299647&view=rev
Log:
[SelectionDAG]  NFC patch removing a redundant check.

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().

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=299647&r1=299646&r2=299647&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Apr  6 08:00:37 2017
@@ -4208,15 +4208,11 @@ SDValue SelectionDAG::getNode(unsigned O
           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;
   }




More information about the llvm-commits mailing list