https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114999
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- `~a` and `a + 1` are also negative of each other too: ``` int f(int a, int b) { int t = ~a; int t1 = -t; return t1 == t; } int f1(int a) { return (~a) == (-~a); } int f2(int a) { return (a) == (-a); } int f3(int a) { a = ~a; return (a) == (-a); } int f4(int a) { a = ~a; return f2(a); } ``` Right now I have a patch which handles `a == -a` for `(a-b)`/`b-a`. I need one that matches `~a` with the corresponding `a + 1` too. Note gimple_bitwise_inverted_equal_p should also be expanded to support `-a` with `a + -1` too.