diff options
author | Richard Biener <rguenther@suse.de> | 2022-09-14 13:53:56 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2022-09-14 14:50:36 +0200 |
commit | cd14c97cd92ca11c66ee3d8dc4dd543c5aa8e024 (patch) | |
tree | 9936c7b2d0245ae14a1ec0eb179adc356eea8a67 /gcc/tree-cfg.cc | |
parent | 12a8d5e2f2e7d7535115e4e105c0f9eb4d50fdad (diff) | |
download | gcc-cd14c97cd92ca11c66ee3d8dc4dd543c5aa8e024.zip gcc-cd14c97cd92ca11c66ee3d8dc4dd543c5aa8e024.tar.gz gcc-cd14c97cd92ca11c66ee3d8dc4dd543c5aa8e024.tar.bz2 |
tree-optimization/106938 - cleanup abnormal edges after inlining
After inlining and IPA transforms we run fixup_cfg to fixup CFG
effects in other functions. But that fails to clean abnormal
edges from non-pure/const calls which might no longer be necessary
when ->calls_setjmp is false. The following ensures this happens
and refactors things so we call EH/abnormal cleanup only on the
last stmt in a block.
PR tree-optimization/106938
* tree-cfg.cc (execute_fixup_cfg): Purge dead abnormal
edges for all last stmts in a block. Do EH cleanup
only on the last stmt in a block.
* gcc.dg/pr106938.c: New testcase.
Diffstat (limited to 'gcc/tree-cfg.cc')
-rw-r--r-- | gcc/tree-cfg.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc index 41ce1b2..53be0c2 100644 --- a/gcc/tree-cfg.cc +++ b/gcc/tree-cfg.cc @@ -9836,16 +9836,12 @@ execute_fixup_cfg (void) int flags = gimple_call_flags (stmt); if (flags & (ECF_CONST | ECF_PURE | ECF_LOOPING_CONST_OR_PURE)) { - if (gimple_purge_dead_abnormal_call_edges (bb)) - todo |= TODO_cleanup_cfg; - if (gimple_in_ssa_p (cfun)) { todo |= TODO_update_ssa | TODO_cleanup_cfg; update_stmt (stmt); } } - if (flags & ECF_NORETURN && fixup_noreturn_call (stmt)) todo |= TODO_cleanup_cfg; @@ -9875,10 +9871,15 @@ execute_fixup_cfg (void) } } - if (maybe_clean_eh_stmt (stmt) + gsi_next (&gsi); + } + if (gimple *last = last_stmt (bb)) + { + if (maybe_clean_eh_stmt (last) && gimple_purge_dead_eh_edges (bb)) todo |= TODO_cleanup_cfg; - gsi_next (&gsi); + if (gimple_purge_dead_abnormal_call_edges (bb)) + todo |= TODO_cleanup_cfg; } /* If we have a basic block with no successors that does not |