]> granicus.if.org Git - llvm/commitdiff
[SelectionDAG] fold insert subvector of undef into undef
authorSanjay Patel <spatel@rotateright.com>
Tue, 21 May 2019 18:53:53 +0000 (18:53 +0000)
committerSanjay Patel <spatel@rotateright.com>
Tue, 21 May 2019 18:53:53 +0000 (18:53 +0000)
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

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 0758a31ec9957fb5629daa860c3e223c7e704949..366b404b30446b019d6fdc9af155c11bf265258e 100644 (file)
@@ -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()) {