[InstCombine] not(sub X, Y) --> add (not X), Y
authorSanjay Patel <spatel@rotateright.com>
Fri, 27 Jul 2018 10:54:48 +0000 (10:54 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 27 Jul 2018 10:54:48 +0000 (10:54 +0000)
commit78e4b4d3c442a8ee97f2488a7ec690146a42c6ac
tree4f9156d2565b67ba23874dbb66350436849a675d
parenteee52b5090de793274bbb589b5a9ac64808f01bc
[InstCombine] not(sub X, Y) --> add (not X), Y

The tests with constants show a missing optimization.
Analysis for adds is better than subs, so this can also
help with other transforms. And codegen is better with
adds for targets like x86 (destructive ops, no sub-from).

https://rise4fun.com/Alive/llK

llvm-svn: 338118
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/sub-not.ll
llvm/test/Transforms/InstCombine/vector-xor.ll