https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89536
--- Comment #13 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- > On the testcase, value is -2 and before your change it would derive > correctly that if BIT_NOT_EXPR is -2, then rhs must be ~-2, i.e. 1, but > after the patch it says rhs must be 0. The oversight is actually on the integer_zerop predicate itself so: Index: tree-ssa-dom.c =================================================================== --- tree-ssa-dom.c (revision 269211) +++ tree-ssa-dom.c (working copy) @@ -348,7 +348,7 @@ edge_info::derive_equivalences (tree nam && TREE_CODE (rhs) == SSA_NAME && ssa_name_has_boolean_range (rhs)) { - if (integer_zerop (value)) + if ((TREE_INT_CST_LOW (value) & 1) == 0) res = build_one_cst (TREE_TYPE (rhs)); else res = build_zero_cst (TREE_TYPE (rhs)); is the immediate fix. On the other hand, if your line of reasoning is correct, then we must restrict both the BIT_AND_EXPR and the BIT_NOT_EXPR cases to bona-fide boolean types.