[PATCH] D31651: Fix in SelectionDAG::getNode() to not produce illegal BUILD_VECTOR operands

Nirav Dave via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 11:43:44 PDT 2017


niravd added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4143
+      llvm::EVT LegalScalarVT = (TLI->isTypeLegal(VT.getScalarType()) ?
+         VT.getScalarType() : N1.getOperand(0).getValueType().getScalarType());
+
----------------
It doesn't seems like we should have to consider if the type is legal. VT should never have been used. 

We should be able to use Op.getValueType().getScalarType() wherever LegalScalarVT is used. 


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4148
         SDValue Op = N1.getOperand(i);
-        if (Op.isUndef()) {
-          Ops.push_back(getUNDEF(VT.getScalarType()));
-          continue;
-        }
-        if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op)) {
+        if (Op.isUndef())
+          Ops.push_back(getUNDEF(LegalScalarVT));
----------------
This removal of the redundant check seems reasonable and should probably be done as a separate NFC cleanup. 


https://reviews.llvm.org/D31651





More information about the llvm-commits mailing list