]> granicus.if.org Git - llvm/commit
[InstCombine] Fold sub (or A, B) (and A, B) to (xor A, B)
authorDavid Bolvansky <david.bolvansky@gmail.com>
Wed, 4 Sep 2019 12:00:33 +0000 (12:00 +0000)
committerDavid Bolvansky <david.bolvansky@gmail.com>
Wed, 4 Sep 2019 12:00:33 +0000 (12:00 +0000)
commit4743865ece09b23e5ef5b14429a5e271975531ce
treeff9860af3c9f10aecaad70b3e6cb6dfa07bfd8d7
parent46d77aab1fc8b588a8efcbaa9cbb3a56a3713276
[InstCombine] Fold sub (or A, B) (and A, B) to (xor A, B)

Summary:
```
Name: sub or and to xor
%or = or i32 %y, %x
%and = and i32 %x, %y
%sub = sub i32 %or, %and
  =>
%sub = xor i32 %x, %y

Optimization: sub or and to xor
Done: 1
Optimization is correct!
```
https://rise4fun.com/Alive/eJu

Reviewers: spatel, lebedev.ri

Reviewed By: lebedev.ri

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370883 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineAddSub.cpp
test/Transforms/InstCombine/sub-or-and-xor.ll