https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124497
Bug ID: 124497
Summary: delete_unreachable_blocks vs cleanup_cfg after
purge_all_dead_edges call
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: internal-improvement
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
So some places uses delete_unreachable_blocks while others cleanup_cfg after
the call to purge_all_dead_edges even in the same file/function.
dse.cc for an example:
```
/* DSE can eliminate potentially-trapping MEMs.
Remove any EH edges associated with them, since otherwise
DF_LR_RUN_DCE will complain later. */
if ((locally_deleted || globally_deleted)
&& cfun->can_throw_non_call_exceptions
&& purge_all_dead_edges ())
{
free_dominance_info (CDI_DOMINATORS);
delete_unreachable_blocks ();
}
...
/* DSE can eliminate potentially-trapping MEMs.
Remove any EH edges associated with them. */
if ((locally_deleted || globally_deleted)
&& cfun->can_throw_non_call_exceptions
&& purge_all_dead_edges ())
{
free_dominance_info (CDI_DOMINATORS);
cleanup_cfg (0);
}
```
ira.cc has:
```
if (purge_all_dead_edges ())
delete_unreachable_blocks ();
```
While postreload.cc has:
```
/* Reload_cse_regs can eliminate potentially-trapping MEMs.
Remove any EH edges associated with them. */
if (fun->can_throw_non_call_exceptions
&& purge_all_dead_edges ())
cleanup_cfg (0);
```
Note in the case of the ira.cc change, it is done after doing indirect to
direct jumps.