OSDN Git Service

[DAGCombiner][X86] Fold (not (neg X)) -> (add X, -1)
authorCraig Topper <craig.topper@intel.com>
Tue, 4 Jun 2019 17:44:18 +0000 (17:44 +0000)
committerCraig Topper <craig.topper@intel.com>
Tue, 4 Jun 2019 17:44:18 +0000 (17:44 +0000)
commit74136095bc65da76bd05b5e7cc2e9bfec95daeba
treef1b151a466c2d1744ce3ca4abc5e08d7c499cca3
parent2b5c011fbaa8e0424dd8e08502f4bf1e577bc16a
[DAGCombiner][X86] Fold (not (neg X)) -> (add X, -1)

This is a special case of a more general transform (not (sub Y, X)) -> (add X, ~Y). InstCombine knows the general form. I've restricted to the special case to fix the motivating case PR42118. I tried handling any case where Y was constant, but got some changes on some Mips tests that I couldn't quickly prove where beneficial.

Fixes PR42118

Differential Revision: https://reviews.llvm.org/D62828

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362533 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/bmi.ll