From: Sanjay Patel Date: Tue, 21 May 2019 18:53:53 +0000 (+0000) Subject: [SelectionDAG] fold insert subvector of undef into undef X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba36ccd5d2c3d80356c8abf914e0f0228c612dd4;p=llvm [SelectionDAG] fold insert subvector of undef into undef DAGCombiner simplifies this more liberally as: // If inserting an UNDEF, just return the original vector. if (N1.isUndef()) return N0; So there's no way to make this visible in output AFAIK, but doing this at node creation time should be slightly more efficient. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361287 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 0758a31ec99..366b404b304 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -5367,6 +5367,9 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT, break; } case ISD::INSERT_SUBVECTOR: { + // Inserting undef into undef is still undef. + if (N1.isUndef() && N2.isUndef()) + return getUNDEF(VT); SDValue Index = N3; if (VT.isSimple() && N1.getValueType().isSimple() && N2.getValueType().isSimple()) {