From aaa52a96feb60e1575f284e2fe87a851ec312b61 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 21 Jan 2011 20:35:42 +0100 Subject: [PATCH] re PR middle-end/45566 (ICE: in convert_to_eh_region_ranges, at except.c:2446 with -freorder-blocks-and-partition -fnon-call-exceptions -fprofile-use) PR middle-end/45566 * except.c (convert_to_eh_region_ranges): Emit queued no-region notes from other section in hot/cold partitioning even if last_action is -3. Increment call_site_base. * g++.dg/tree-prof/partition3.C: New test. * g++.dg/tree-prof/tree-prof.exp: Fix a comment. From-SVN: r169101 --- gcc/ChangeLog | 5 ++++ gcc/except.c | 39 +++++++++++++++------------- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/g++.dg/tree-prof/partition3.C | 18 +++++++++++++ gcc/testsuite/g++.dg/tree-prof/tree-prof.exp | 2 +- 5 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 gcc/testsuite/g++.dg/tree-prof/partition3.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ab3c70b..db2be18 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2011-01-21 Jakub Jelinek + PR middle-end/45566 + * except.c (convert_to_eh_region_ranges): Emit queued no-region + notes from other section in hot/cold partitioning even if + last_action is -3. Increment call_site_base. + PR rtl-optimization/47366 * fwprop.c (forward_propagate_into): Return bool. If any changes are made, -fnon-call-exceptions is used and diff --git a/gcc/except.c b/gcc/except.c index 3e2bbfb..66bf410 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -2421,30 +2421,33 @@ convert_to_eh_region_ranges (void) if (last_action != this_action || last_landing_pad != this_landing_pad) { + /* If there is a queued no-action region in the other section + with hot/cold partitioning, emit it now. */ + if (first_no_action_insn_before_switch) + { + gcc_assert (this_action != -1 + && last_action == (first_no_action_insn + ? -1 : -3)); + call_site = add_call_site (NULL_RTX, 0, 0); + note = emit_note_before (NOTE_INSN_EH_REGION_BEG, + first_no_action_insn_before_switch); + NOTE_EH_HANDLER (note) = call_site; + note = emit_note_after (NOTE_INSN_EH_REGION_END, + last_no_action_insn_before_switch); + NOTE_EH_HANDLER (note) = call_site; + gcc_assert (last_action != -3 + || (last_action_insn + == last_no_action_insn_before_switch)); + first_no_action_insn_before_switch = NULL_RTX; + last_no_action_insn_before_switch = NULL_RTX; + call_site_base++; + } /* If we'd not seen a previous action (-3) or the previous action was must-not-throw (-2), then we do not need an end note. */ if (last_action >= -1) { /* If we delayed the creation of the begin, do it now. */ - if (first_no_action_insn_before_switch) - { - call_site = add_call_site (NULL_RTX, 0, 0); - note - = emit_note_before (NOTE_INSN_EH_REGION_BEG, - first_no_action_insn_before_switch); - NOTE_EH_HANDLER (note) = call_site; - if (first_no_action_insn) - { - note - = emit_note_after (NOTE_INSN_EH_REGION_END, - last_no_action_insn_before_switch); - NOTE_EH_HANDLER (note) = call_site; - } - else - gcc_assert (last_action_insn - == last_no_action_insn_before_switch); - } if (first_no_action_insn) { call_site = add_call_site (NULL_RTX, 0, cur_sec); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2c1e8fb..657a61d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2011-01-21 Jakub Jelinek + PR middle-end/45566 + * g++.dg/tree-prof/partition3.C: New test. + + * g++.dg/tree-prof/tree-prof.exp: Fix a comment. + PR rtl-optimization/47366 * g++.dg/opt/pr47366.C: New test. diff --git a/gcc/testsuite/g++.dg/tree-prof/partition3.C b/gcc/testsuite/g++.dg/tree-prof/partition3.C new file mode 100644 index 0000000..7846983 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-prof/partition3.C @@ -0,0 +1,18 @@ +// PR middle-end/45566 +// { dg-require-effective-target freorder } +// { dg-options "-O -fnon-call-exceptions -freorder-blocks-and-partition" } + +int k; + +int +main () +{ + try + { + if (k) + throw 6; + } + catch (...) + { + } +} diff --git a/gcc/testsuite/g++.dg/tree-prof/tree-prof.exp b/gcc/testsuite/g++.dg/tree-prof/tree-prof.exp index b5a2f65..92de032 100644 --- a/gcc/testsuite/g++.dg/tree-prof/tree-prof.exp +++ b/gcc/testsuite/g++.dg/tree-prof/tree-prof.exp @@ -16,7 +16,7 @@ # . # Test the functionality of programs compiled with profile-directed block -# ordering using -fprofile-generate followed by -fbranch-use. +# ordering using -fprofile-generate followed by -fprofile-use. load_lib target-supports.exp -- 2.7.4