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

--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
This is broken:
```
  /* Alter the exit condition of the loop to always exit.  */
  gcond* loop_exit_cond = get_loop_exit_condition (m_crc_loop);
  gimple_cond_make_false (loop_exit_cond);
  update_stmt (loop_exit_cond);
```


The problem is the loop exit edge does not have to be the true edge; it could
have been the false edge.

The simple fix I think is this:
```
if (single_exit (m_crc_loop)->flags & EDGE_TRUE_VALUE)
  gimple_cond_make_true (loop_exit_cond);
else
  gimple_cond_make_false (loop_exit_cond);
```

Reply via email to