[InstCombine] ~(C + X) --> ~C - X (PR50308)
authorRoman Lebedev <lebedev.ri@gmail.com>
Wed, 12 May 2021 13:09:37 +0000 (16:09 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Wed, 12 May 2021 13:10:55 +0000 (16:10 +0300)
commit554b1bced325a8d860ad00bd59020d66d01c95f8
tree02e12b455adbc26eabdd398a659500070eb91473
parenta383d325f6c6c8d9bb52d1da221d9a144dfc475c
[InstCombine] ~(C + X) --> ~C - X (PR50308)

We can not rely on (C+X)-->(X+C) already happening,
because we might not have visited that `add` yet.
The added testcase would get stuck in an endless combine loop.
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/not-add.ll