https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117859
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
/* (A CMP B) != 0 is the same as (A CMP B).
(A CMP B) == 0 is just (A CMP B) with the edges swapped. */
if (is_gimple_assign (def_stmt)
&& TREE_CODE_CLASS (gimple_assign_rhs_code (def_stmt)) ==
tcc_comparison)
{
tree_code nc = gimple_assign_rhs_code (def_stmt);
tree nlhs = vn_valueize (gimple_assign_rhs1 (def_stmt));
tree nrhs = vn_valueize (gimple_assign_rhs2 (def_stmt));
edge nt = true_e;
edge nf = false_e;
if (code == EQ_EXPR)
std::swap (nt, nf);
insert_predicates_for_cond (nc, nlhs, nrhs, nt, nf);
}
Looks like nrhs could return back to rhs.
Will fix this tomorrow.