[llvm] r273802 - [SelectionDAG] Use DAG.getCommutedVectorShuffle instead of reimplementing it.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 25 22:10:49 PDT 2016


Author: ctopper
Date: Sun Jun 26 00:10:49 2016
New Revision: 273802

URL: http://llvm.org/viewvc/llvm-project?rev=273802&view=rev
Log:
[SelectionDAG] Use DAG.getCommutedVectorShuffle instead of reimplementing it.

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

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=273802&r1=273801&r2=273802&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sun Jun 26 00:10:49 2016
@@ -13420,21 +13420,8 @@ SDValue DAGCombiner::visitVECTOR_SHUFFLE
   }
 
   // Canonicalize shuffle undef, v -> v, undef.  Commute the shuffle mask.
-  if (N0.isUndef()) {
-    SmallVector<int, 8> NewMask;
-    for (unsigned i = 0; i != NumElts; ++i) {
-      int Idx = SVN->getMaskElt(i);
-      if (Idx >= 0) {
-        if (Idx >= (int)NumElts)
-          Idx -= NumElts;
-        else
-          Idx = -1; // remove reference to lhs
-      }
-      NewMask.push_back(Idx);
-    }
-    return DAG.getVectorShuffle(VT, SDLoc(N), N1, DAG.getUNDEF(VT),
-                                &NewMask[0]);
-  }
+  if (N0.isUndef())
+    return DAG.getCommutedVectorShuffle(*SVN);
 
   // Remove references to rhs if it is undef
   if (N1.isUndef()) {




More information about the llvm-commits mailing list