[llvm] r361287 - [SelectionDAG] fold insert subvector of undef into undef

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue May 21 11:53:54 PDT 2019


Author: spatel
Date: Tue May 21 11:53:53 2019
New Revision: 361287

URL: http://llvm.org/viewvc/llvm-project?rev=361287&view=rev
Log:
[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.

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=361287&r1=361286&r2=361287&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue May 21 11:53:53 2019
@@ -5367,6 +5367,9 @@ SDValue SelectionDAG::getNode(unsigned O
     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()) {




More information about the llvm-commits mailing list