]> granicus.if.org Git - llvm/commitdiff
[DAGCombine] Teach DAG combine that if both inputs of a vselect are the same, then...
authorCraig Topper <craig.topper@gmail.com>
Thu, 24 Nov 2016 21:48:52 +0000 (21:48 +0000)
committerCraig Topper <craig.topper@gmail.com>
Thu, 24 Nov 2016 21:48:52 +0000 (21:48 +0000)
Selects with scalar condition already handle this correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287904 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index e3cab19733bf13331fa53028e8c8b8a48b5a4fe2..49e64903f46cb0abe59991eff77bd91df290219b 100644 (file)
@@ -5774,6 +5774,10 @@ SDValue DAGCombiner::visitVSELECT(SDNode *N) {
   SDValue N2 = N->getOperand(2);
   SDLoc DL(N);
 
+  // fold (vselect C, X, X) -> X
+  if (N1 == N2)
+    return N1;
+
   // Canonicalize integer abs.
   // vselect (setg[te] X,  0),  X, -X ->
   // vselect (setgt    X, -1),  X, -X ->