[DAGCombiner] sub X, 0/1 --> add X, 0/-1
authorSanjay Patel <spatel@rotateright.com>
Wed, 30 Jan 2019 22:41:35 +0000 (22:41 +0000)
committerSanjay Patel <spatel@rotateright.com>
Wed, 30 Jan 2019 22:41:35 +0000 (22:41 +0000)
commit9ab23101a82440c91d630596e0e8264103a34f74
tree93b9b6ebf9b3a7dd227909a2876f220d6799f768
parentc6d261efdb184cddf4380d8c450d09936afdecf4
[DAGCombiner] sub X, 0/1 --> add X, 0/-1

This extends the existing transform for:
add X, 0/1 --> sub X, 0/-1
...to allow the sibling subtraction fold.

This pattern could regress with the proposed change in D57401.

llvm-svn: 352680
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/bool-ext-inc.ll
llvm/test/CodeGen/X86/bool-ext-inc.ll
llvm/test/CodeGen/X86/select_const.ll