[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #25 from Andrey Belevantsev abel at gcc dot gnu.org 2011-06-20 11:56:11 UTC --- Author: abel Date: Mon Jun 20 11:56:08 2011 New Revision: 175207 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=175207 Log: Backport from mainline 2010-12-07 Andrey Belevantsev a...@ispras.ru PR target/43603 * haifa-sched.c (sched_create_recovery_edges): Update dominator info. * sel-sched-ir.c (maybe_tidy_empty_bb): Update dominator info after deleting an empty block, verify dominators. (sel_remove_bb): Update dominator info after removing a block. (sel_redirect_edge_and_branch_force): Assert that no unreachable blocks will be created. Update dominator info. (sel_redirect_edge_and_branch): Update dominator info when basic blocks do not become unreachable. (sel_remove_loop_preheader): Update dominator info. 2010-10-14 Andrey Belevantsev a...@ispras.ru * sel-sched-ir.c (maybe_tidy_empty_bb): Simplify comment. (tidy_control_flow): Tidy vertical space. (sel_remove_bb): New variable idx. Use it to remember the basic block index before deleting the block. (sel_remove_empty_bb): Remove dead code, simplify and insert to ... (sel_merge_blocks): ... here. Add forward declaration. * sel-sched-ir.h (sel_remove_empty_bb): Remove prototype. (sel_merge_blocks): Likewise. 2011-06-20 Andrey Belevantsev a...@ispras.ru Backport from mainline 2010-12-07 Andrey Belevantsev a...@ispras.ru PR target/43603 * gcc.target/ia64/pr43603.c: New. * gcc/testsuite/g++.dg/opt/pr46640.C: New. Added: branches/gcc-4_4-branch/gcc/testsuite/g++.dg/opt/pr46640.C branches/gcc-4_4-branch/gcc/testsuite/gcc.target/ia64/pr43603.c Modified: branches/gcc-4_4-branch/gcc/ChangeLog branches/gcc-4_4-branch/gcc/haifa-sched.c branches/gcc-4_4-branch/gcc/sel-sched-ir.c branches/gcc-4_4-branch/gcc/sel-sched-ir.h branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #26 from devurandom at gmx dot net 2011-06-20 12:09:26 UTC --- Thanks a lot!
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #22 from devurandom at gmx dot net 2011-06-17 11:21:02 UTC --- (In reply to comment #20) Created attachment 24112 [details] backported patch Good. Then attached is the initial backport, I have just verified that it passes the testcase. It would be great if the Gentoo folks could test it in their setup, too. If all goes well, I will apply it to 4_4-branch at the beginning of May. Is this applied to any branch yet?
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #23 from devurandom at gmx dot net 2011-06-17 14:04:50 UTC --- (In reply to comment #22) (In reply to comment #20) Created attachment 24112 [details] backported patch Good. Then attached is the initial backport, I have just verified that it passes the testcase. It would be great if the Gentoo folks could test it in their setup, too. If all goes well, I will apply it to 4_4-branch at the beginning of May. Is this applied to any branch yet? Confirming that the attached patch allows compilation of Erlang 14B03 when applied to GCC 4.4.5.
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #24 from Andrey Belevantsev abel at gcc dot gnu.org 2011-06-17 15:08:55 UTC --- Thanks for reminder, I've started bootstap and test on ia64 and x86-64.
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #15 from devurandom at gmx dot net 2011-04-27 07:45:19 UTC --- (In reply to comment #14) (In reply to comment #13) Fixed on 4.5. Can it please be fixed in 4.4, too? (Maybe I am wrong, but I see only commits to trunk/4.6 and 4.5 here.)
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #16 from Andrey Belevantsev abel at gcc dot gnu.org 2011-04-27 08:10:12 UTC --- The patch from 4.5 can likely be ported to 4.4 somewhat easy, however, it is big enough and I am not sure that there will be any more releases off 4.4-branch. If there is such a need of having this in 4.4, and if there will indeed be another 4.4 release, I can do the porting.
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #18 from devurandom at gmx dot net 2011-04-27 08:26:51 UTC --- P.S: Maybe you can backport it anyway, since I opened Gentoo bug #365045 [1]. Having the backport readily available from upstream would probably help including it in a distro release of GCC. [1] http://bugs.gentoo.org/show_bug.cgi?id=365045
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #17 from devurandom at gmx dot net 2011-04-27 08:25:13 UTC --- This bug prevents Erlang 14B2 from building on my machine, so for me it is serious. Someone else has to tell whether there will be further 4.4 releases, of course.
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 Jakub Jelinek jakub at gcc dot gnu.org changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #19 from Jakub Jelinek jakub at gcc dot gnu.org 2011-04-27 09:23:35 UTC --- 4.4.7 release is tentatively planned, roughly for late Autumn 2011.
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #20 from Andrey Belevantsev abel at gcc dot gnu.org 2011-04-27 10:04:38 UTC --- Created attachment 24112 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=24112 backported patch Good. Then attached is the initial backport, I have just verified that it passes the testcase. It would be great if the Gentoo folks could test it in their setup, too. If all goes well, I will apply it to 4_4-branch at the beginning of May.
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #21 from devurandom at gmx dot net 2011-04-27 10:56:18 UTC --- (In reply to comment #20) Created attachment 24112 [details] backported patch Thanks! I notified downstream, hopefully they will give it testing through a bump to gcc-4.4.[56].
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #14 from devurandom at gmx dot net 2011-04-13 08:05:35 UTC --- (In reply to comment #13) Fixed on 4.5. Will 4.4 also be fixed? A release candidate for 4.4.6 was just released, so it should probably happen quickly.
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #12 from Andrey Belevantsev abel at gcc dot gnu.org 2011-04-07 06:59:21 UTC --- Author: abel Date: Thu Apr 7 06:59:19 2011 New Revision: 172084 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=172084 Log: Backport from mainline 2010-12-07 Andrey Belevantsev a...@ispras.ru PR target/43603 * haifa-sched.c (sched_create_recovery_edges): Update dominator info. * sel-sched-ir.c (maybe_tidy_empty_bb): Update dominator info after deleting an empty block. (tidy_control_flow): Also verify dominators. (sel_remove_bb): Update dominator info after removing a block. (sel_redirect_edge_and_branch_force): Assert that no unreachable blocks will be created. Update dominator info. (sel_redirect_edge_and_branch): Update dominator info when basic blocks do not become unreachable. (sel_remove_loop_preheader): Update dominator info. 2010-10-14 Andrey Belevantsev a...@ispras.ru * sel-sched-ir.c (maybe_tidy_empty_bb): Simplify comment. (tidy_control_flow): Tidy vertical space. (sel_remove_bb): New variable idx. Use it to remember the basic block index before deleting the block. (sel_remove_empty_bb): Remove dead code, simplify and insert to ... (sel_merge_blocks): ... here. * sel-sched-ir.h (sel_remove_empty_bb): Remove prototype. Added: branches/gcc-4_5-branch/gcc/testsuite/g++.dg/opt/pr46640.C branches/gcc-4_5-branch/gcc/testsuite/gcc.target/ia64/pr43603.c Modified: branches/gcc-4_5-branch/gcc/ChangeLog branches/gcc-4_5-branch/gcc/haifa-sched.c branches/gcc-4_5-branch/gcc/sel-sched-ir.c branches/gcc-4_5-branch/gcc/sel-sched-ir.h branches/gcc-4_5-branch/gcc/testsuite/ChangeLog
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 Andrey Belevantsev abel at gcc dot gnu.org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED --- Comment #13 from Andrey Belevantsev abel at gcc dot gnu.org 2011-04-07 07:09:33 UTC --- Fixed on 4.5.
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #10 from Andrey Belevantsev abel at gcc dot gnu.org 2011-03-21 12:07:57 UTC --- (In reply to comment #9) Andrey, I was just looking at PR 48191, a bug submitted against GCC 4.5.2. It looks like it is caused by the same problem that this patch fixes. Can you back port this fix to the 4.5 branch? Also is there any reason not to close this defect as resolved since it is fixed on the trunk and in 4.6. Hi Steve, I was hoping to port a couple of fixes to 4.5, including this one, but got busy with other stuff. The PR was there to remind me of doing this, evidently not effectively. Thanks for pinging me. I will determine the PRs that need to be backported to 4.5 within two weeks.
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #11 from Steve Ellcey sje at cup dot hp.com 2011-03-21 17:30:34 UTC --- *** Bug 48191 has been marked as a duplicate of this bug. ***
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #9 from Steve Ellcey sje at cup dot hp.com 2011-03-18 23:45:07 UTC --- Andrey, I was just looking at PR 48191, a bug submitted against GCC 4.5.2. It looks like it is caused by the same problem that this patch fixes. Can you back port this fix to the 4.5 branch? Also is there any reason not to close this defect as resolved since it is fixed on the trunk and in 4.6.
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 --- Comment #8 from Andrey Belevantsev abel at gcc dot gnu.org 2010-12-08 13:56:00 UTC --- Author: abel Date: Wed Dec 8 13:55:57 2010 New Revision: 167588 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=167588 Log: PR target/43603 * haifa-sched.c (sched_create_recovery_edges): Update dominator info. * sel-sched-ir.c (maybe_tidy_empty_bb): Update dominator info after deleting an empty block. (tidy_control_flow): Also verify dominators. (sel_remove_bb): Update dominator info after removing a block. (sel_redirect_edge_and_branch_force): Assert that no unreachable blocks will be created. Update dominator info. (sel_redirect_edge_and_branch): Update dominator info when basic blocks do not become unreachable. (sel_remove_loop_preheader): Update dominator info. Added: trunk/gcc/testsuite/g++.dg/opt/pr46640.C trunk/gcc/testsuite/gcc.target/ia64/pr43603.c Modified: trunk/gcc/ChangeLog trunk/gcc/haifa-sched.c trunk/gcc/sel-sched-ir.c trunk/gcc/testsuite/ChangeLog
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 Andrew Pinski pinskia at gcc dot gnu.org changed: What|Removed |Added CC||zsojka at seznam dot cz --- Comment #7 from Andrew Pinski pinskia at gcc dot gnu.org 2010-11-24 18:23:48 UTC --- *** Bug 46640 has been marked as a duplicate of this bug. ***
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603 Andrew Pinski pinskia at gcc dot gnu.org changed: What|Removed |Added CC||dannf at dannf dot org --- Comment #6 from Andrew Pinski pinskia at gcc dot gnu.org 2010-11-09 17:11:00 UTC --- *** Bug 46384 has been marked as a duplicate of this bug. ***
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
--- Comment #5 from abel at gcc dot gnu dot org 2010-06-30 08:44 --- The below patch implements keeping dominance info up to date in the scheduler. After discussions with Alexander, I think that it will be better to leave the copy_rtx calls as is, so that if we'll see this problem once again, we fail immediately instead of silently miscompiling code. The patch fixes both this testcase and PR 44233's testcase. (Also, Zdenek kindly provided a patch for the dominator tree infrastructure that eases the development by failing immediately when the dominator data structures become inconsistent, and I've made a cleanup patch in the scheduler. I will also submit both of those patches.) gcc/haifa-sched.c |2 + gcc/sel-sched-ir.c | 53 +++ 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 8d7149f..6bf526e 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -4452,6 +4452,8 @@ sched_create_recovery_edges (basic_block first_bb, basic_block rec, edge_flags = 0; make_single_succ_edge (rec, second_bb, edge_flags); + if (dom_info_available_p (CDI_DOMINATORS)) +set_immediate_dominator (CDI_DOMINATORS, rec, first_bb); } /* This function creates recovery code for INSN. If MUTATE_P is nonzero, diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index 3146a26..f2be2df 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -3544,6 +3544,7 @@ static bool maybe_tidy_empty_bb (basic_block bb, bool recompute_toporder_p) { basic_block succ_bb, pred_bb; + VEC (basic_block, heap) *dom_bbs; edge e; edge_iterator ei; bool rescan_p; @@ -3579,6 +3580,7 @@ maybe_tidy_empty_bb (basic_block bb, bool recompute_toporder_p) succ_bb = single_succ (bb); rescan_p = true; pred_bb = NULL; + dom_bbs = NULL; /* Redirect all non-fallthru edges to the next bb. */ while (rescan_p) @@ -3591,6 +3593,12 @@ maybe_tidy_empty_bb (basic_block bb, bool recompute_toporder_p) if (!(e-flags EDGE_FALLTHRU)) { + /* We will update dominators here only when we'll get + an unreachable block when redirecting, otherwise + sel_redirect_edge_and_branch will take care of it. */ + if (e-dest != bb + single_pred_p (e-dest)) +VEC_safe_push (basic_block, heap, dom_bbs, e-dest); recompute_toporder_p |= sel_redirect_edge_and_branch (e, succ_bb); rescan_p = true; break; @@ -3610,11 +3618,20 @@ maybe_tidy_empty_bb (basic_block bb, bool recompute_toporder_p) remove_empty_bb (bb, true); } + + if (!VEC_empty (basic_block, dom_bbs)) +{ + VEC_safe_push (basic_block, heap, dom_bbs, succ_bb); + iterate_fix_dominators (CDI_DOMINATORS, dom_bbs, false); + VEC_free (basic_block, heap, dom_bbs); +} + if (recompute_toporder_p) sel_recompute_toporder (); #ifdef ENABLE_CHECKING verify_backedges (); + verify_dominators (CDI_DOMINATORS); #endif return true; @@ -5026,7 +5043,12 @@ sel_remove_bb (basic_block bb, bool remove_from_cfg_p) bitmap_clear_bit (blocks_to_reschedule, idx); if (remove_from_cfg_p) -delete_and_free_basic_block (bb); +{ + basic_block succ = single_succ (bb); + delete_and_free_basic_block (bb); + set_immediate_dominator (CDI_DOMINATORS, succ, + recompute_dominator (CDI_DOMINATORS, succ)); +} rgn_setup_region (CONTAINING_RGN (idx)); } @@ -5361,12 +5383,15 @@ sel_merge_blocks (basic_block a, basic_block b) void sel_redirect_edge_and_branch_force (edge e, basic_block to) { - basic_block jump_bb, src; + basic_block jump_bb, src, orig_dest = e-dest; int prev_max_uid; rtx jump; - gcc_assert (!sel_bb_empty_p (e-src)); - + /* This function is now used only for bookkeeping code creation, where + we'll never get the single pred of orig_dest block and thus will not + hit unreachable blocks when updating dominator info. */ + gcc_assert (!sel_bb_empty_p (e-src) + !single_pred_p (orig_dest)); src = e-src; prev_max_uid = get_max_uid (); jump_bb = redirect_edge_and_branch_force (e, to); @@ -5383,6 +5408,10 @@ sel_redirect_edge_and_branch_force (edge e, basic_block to) jump = find_new_jump (src, jump_bb, prev_max_uid); if (jump) sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP); + set_immediate_dominator (CDI_DOMINATORS, orig_dest, + recompute_dominator (CDI_DOMINATORS, orig_dest)); + set_immediate_dominator (CDI_DOMINATORS, to, + recompute_dominator (CDI_DOMINATORS, to)); } /* A wrapper for redirect_edge_and_branch. Return TRUE if blocks connected by @@ -5391,11 +5420,12 @@ bool sel_redirect_edge_and_branch (edge e, basic_block to) { bool latch_edge_p; - basic_block src; +
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
--- Comment #4 from pinskia at gcc dot gnu dot org 2010-05-21 17:47 --- *** Bug 44233 has been marked as a duplicate of this bug. *** -- pinskia at gcc dot gnu dot org changed: What|Removed |Added CC||jason at njkfrudils dot plus ||dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
--- Comment #3 from abel at gcc dot gnu dot org 2010-04-20 08:36 --- The problem is in the remove_insns_that_need_bookkeeping function, which should filter out all instructions that cannot be copied but yet may require bookkeeping. An instruction with asm operands is an example of those insns. In the function, we use dominated_by_p to check that the target block dominates the source block of the instruction, but the answer we get is wrong as the dominance information is broken at this point, and that is because we do not maintain it. We need to devise a patch to update the dominance information in the scheduler using the dominator infrastructure or to stop using it altogether and to rewrite the function in question. The former requires some effort as my first attempt at this failed, the latter will likely lead to performance regressions. I will work further on keeping dominance info up to date. However, the resulting patch will probably be unsuitable for a release branch. That said, the copy_rtx calls should be fixed nevertheless, but currently it should not matter for the instructions we really want to clone. That may change of course. -- abel at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |abel at gcc dot gnu dot org |dot org | Status|NEW |ASSIGNED Last reconfirmed|2010-04-04 01:34:03 |2010-04-20 08:36:09 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
--- Comment #2 from amonakov at gcc dot gnu dot org 2010-04-06 17:10 --- Thanks for the analysis. This is reproducible on trunk with -O2 -fsel-sched-pipelining -fselective-scheduling2 (with -O3, pressure-aware loop invariant motion slightly changes the code, and it's not possible to disable it (not even with -fno-ira-loop-pressure, because it's enabled unconditionally in ia64_override_options)). The real problem is that we are attempting to clone an instruction with asm operands as a bookkeeping copy -- that should never happen. Thus, I think copy_rtx calls should stay. We'll have to fix the scheduler to never attempt such code motion. -- amonakov at gcc dot gnu dot org changed: What|Removed |Added CC||abel at gcc dot gnu dot org, ||amonakov at gcc dot gnu dot ||org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603
[Bug target/43603] gcc-4.4.3 ICE on ia64 with -O3
--- Comment #1 from wilson at gcc dot gnu dot org 2010-04-04 01:34 --- This is failing due to invalid rtl unsharing. The asm has two dests. We end up with a parallel with two sets, and the ASM_OPERAND_INPUT_VEC in each SET_SRC is supposed to be the same rtl pointer. This is checked by asm_noperands. This is necessary for reg-alloc to handle the asm correctly. The invalid unsharing happens in the file sel-sched-ir.c in the function create_copy_of_insn_rtx. It has code res = create_insn_rtx_from_pattern (copy_rtx (PATTERN (insn_rtx)), NULL_RTX); This won't work. You can't use copy_rtx to copy an insn. You must use copy_insn. See the code and comments in emit-rtl.c. This problem can be fixed by changing the copy_rtx to copy_insn, but I'm concerned that there may be other places in sel-sched*.c that also need fixing. I don't know the code well enough to be able to easily tell which copy_rtx calls are broken. The testcase works on mainline, but the bug appears to still be there. This testcase just doesn't trigger it. -- wilson at gcc dot gnu dot org changed: What|Removed |Added CC||wilson at gcc dot gnu dot ||org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2010-04-04 01:34:03 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43603