[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)
commit09a4415803cd590ebb68a5141950366b077f13a7
tree390cc4a57b56939c33765030b79e1c537f8878a4
parent0cdaf3a09fea6db0008828264bf84c91a5b6eba1
[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

llvm-svn: 362533
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/bmi.ll