https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120280

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---


Replaced redundant PHI node defining c_3 with c_6
Replaced redundant PHI node defining b_13 with 0
Removing unexecutable edge from if (b_13 != 0)
Removing dead stmt b_13 = PHI <0(3)>
Removing dead stmt c_3 = PHI <c_6(3)>

(gdb) p debug_tree(t)
 <ssa_name 0x7ffff740d8b8 type <error_mark 0x7ffff7402f48>
    nothrow
    def_stmt
    version:3 in-free-list>


c_19 = PHI <_3(4), c_1(7), c_15(6)>

So FRE removes _3 definition and the bb(4) is not reachable any more.
We are doing cleanup cfg and we call gimple_simplify on the cond:

```
  # c_6 = PHI <0(2), c_19(8)>
  # .MEM_9 = PHI <.MEM_12(D)(2), .MEM_18(8)>
  if (c_6 < d_14(D))
    goto <bb 5>; [INV]
  else
    goto <bb 4>; [INV]
```

Where we are trying to match first tree_expr_nonnegative_p.

So the easy workaround is not use tree_expr_nonnegative_p as predicate here and
just do:
```
 (simplify
  (cmp @0 zerop@1)
  (if (tree_expr_nonnegative_p (@0) && !fixed_zerop (@1)
```

Though I am not 100% sure this will workaround all of the issues.

Reply via email to