diff options
author | Jeff Law <law@redhat.com> | 2018-01-08 11:20:21 -0700 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2018-01-08 11:20:21 -0700 |
commit | 5a2a87e1e2452eddae38e0ae1af4239f92d8c281 (patch) | |
tree | 2a8ac5e5a5abf53775d597fed31ff4df51e1ff93 /gcc/tree-switch-conversion.c | |
parent | b9a4d2ba48c98fb0cc894489a26f1b16b01b1ecd (diff) |
re PR rtl-optimization/81308 (ICE in calc_dfs_tree, at dominance.c:458)
PR rtl-optimizatin/81308
* tree-switch-conversion.c (cfg_altered): New file scoped static.
(process_switch): If group_case_labels makes a change, then set
cfg_altered.
(pass_convert_switch::execute): If a switch is converted, then
set cfg_altered. Return TODO_cfg_cleanup if cfg_altered is true.
PR rtl-optimizatin/81308
* g++.dg/pr81308-1.C: New test.
* g++.dg/pr81308-2.C: New test.
From-SVN: r256349
Diffstat (limited to 'gcc/tree-switch-conversion.c')
-rw-r--r-- | gcc/tree-switch-conversion.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c index fdec59e901d..c2538908340 100644 --- a/gcc/tree-switch-conversion.c +++ b/gcc/tree-switch-conversion.c @@ -60,6 +60,10 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA targetm.case_values_threshold(), or be its own param. */ #define MAX_CASE_BIT_TESTS 3 +/* Track whether or not we have altered the CFG and thus may need to + cleanup the CFG when complete. */ +bool cfg_altered; + /* Split the basic block at the statement pointed to by GSIP, and insert a branch to the target basic block of E_TRUE conditional on tree expression COND. @@ -1492,7 +1496,7 @@ process_switch (gswitch *swtch) /* Group case labels so that we get the right results from the heuristics that decide on the code generation approach for this switch. */ - group_case_labels_stmt (swtch); + cfg_altered |= group_case_labels_stmt (swtch); /* If this switch is now a degenerate case with only a default label, there is nothing left for us to do. */ @@ -1605,6 +1609,7 @@ pass_convert_switch::execute (function *fun) { basic_block bb; + cfg_altered = false; FOR_EACH_BB_FN (bb, fun) { const char *failure_reason; @@ -1625,6 +1630,7 @@ pass_convert_switch::execute (function *fun) failure_reason = process_switch (as_a <gswitch *> (stmt)); if (! failure_reason) { + cfg_altered = true; if (dump_file) { fputs ("Switch converted\n", dump_file); @@ -1648,7 +1654,7 @@ pass_convert_switch::execute (function *fun) } } - return 0; + return cfg_altered ? TODO_cleanup_cfg : 0; } } // anon namespace |