diff options
author | Sanjay Patel <spatel@rotateright.com> | 2018-06-26 19:46:56 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2018-06-26 19:46:56 +0000 |
commit | fb9c440ba59af6206bca6b669de1fa4cb11a1815 (patch) | |
tree | e9d72b061c6036b42ad2266c4618b782e29bb9a6 | |
parent | f60cb34c91de692eda4d4907bfd14f88913d9cfc (diff) | |
download | bcm5719-llvm-fb9c440ba59af6206bca6b669de1fa4cb11a1815.tar.gz bcm5719-llvm-fb9c440ba59af6206bca6b669de1fa4cb11a1815.zip |
[DAGCombiner] use isBitwiseNot to simplify code; NFC
llvm-svn: 335652
-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 |