diff options
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 640f07b262c..e5a10951478 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -6932,15 +6932,10 @@ SDValue DAGCombiner::visitSELECT(SDNode *N) { } } - // select (xor Cond, 1), X, Y -> select Cond, Y, X if (VT0 == MVT::i1) { - if (N0->getOpcode() == ISD::XOR) { - if (auto *C = dyn_cast<ConstantSDNode>(N0->getOperand(1))) { - SDValue Cond0 = N0->getOperand(0); - if (C->isOne()) - return DAG.getNode(ISD::SELECT, DL, N1.getValueType(), Cond0, N2, N1); - } - } + // select (not Cond), N1, N2 -> select Cond, N2, N1 + if (isBitwiseNot(N0)) + return DAG.getNode(ISD::SELECT, DL, VT, N0->getOperand(0), N2, N1); } // fold selects based on a setcc into other things, such as min/max/abs |