* [PATCH] Fix PR rtl-optimization/46755
@ 2010-12-17 20:53 Steven Bosscher
2010-12-17 21:04 ` Steven Bosscher
2010-12-18 18:10 ` Vladimir Makarov
0 siblings, 2 replies; 3+ messages in thread
From: Steven Bosscher @ 2010-12-17 20:53 UTC (permalink / raw)
To: GCC Patches, Vladimir Makarov
Hello,
IRA is one of the last passes to recalculate jump labels. With
Fortran's ASSIGNed GOTO feature, we apparently can end up making
blocks unreachable this way (and probably a C test case can be
constructed too). This is something to anticipate when
purge_all_dead_edges() is called. So although it would be interesting
to find out why the blocks become unreachable so late, I just patched
the compiler at the location where the ICE occurs. The solution is
simply to remove all unreachable basic blocks if
purge_all_dead_edges() nuked some edges.
Bootstrapped&tested on x86_64-unknown-linux-gnu. OK for trunk?
Ciao!
Steven
gcc/
PR rtl-optimization/46755
* ira.c (ira): If some dead edges were removed, find and delete
any blocks that might have become unreachable.
testsuite/
PR rtl-optimization/46755
* gfortran.dg/pr46755.f: New test
Index: ira.c
===================================================================
--- ira.c (revision 167996)
+++ ira.c (working copy)
@@ -3158,7 +3158,8 @@ ira (FILE
{
timevar_push (TV_JUMP);
rebuild_jump_labels (get_insns ());
- purge_all_dead_edges ();
+ if (purge_all_dead_edges ())
+ delete_unreachable_blocks ();
timevar_pop (TV_JUMP);
}
}
Index: testsuite/gfortran.dg/pr46755.f
===================================================================
--- testsuite/gfortran.dg/pr46755.f (revision 0)
+++ testsuite/gfortran.dg/pr46755.f (revision 0)
@@ -0,0 +1,23 @@
+C { dg-do compile }
+C { dg-options "-O" }
+ IMPLICIT NONE
+ INTEGER I640,I760,I800
+ INTEGER I,ITER,ITMX,LENCM
+ LOGICAL QDISK,QDW
+ ASSIGN 801 TO I800
+ GOTO I800
+ 801 CONTINUE
+ ASSIGN 761 TO I760
+ 761 CONTINUE
+ DO I=1,LENCM
+ ENDDO
+ DO WHILE(ITER.LT.ITMX)
+ IF(QDW) THEN
+ ASSIGN 641 to I640
+ GOTO I760
+ 641 CONTINUE
+ ENDIF
+ ENDDO
+ RETURN
+ END
+
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix PR rtl-optimization/46755
2010-12-17 20:53 [PATCH] Fix PR rtl-optimization/46755 Steven Bosscher
@ 2010-12-17 21:04 ` Steven Bosscher
2010-12-18 18:10 ` Vladimir Makarov
1 sibling, 0 replies; 3+ messages in thread
From: Steven Bosscher @ 2010-12-17 21:04 UTC (permalink / raw)
To: GCC Patches, Vladimir Makarov
On Fri, Dec 17, 2010 at 9:38 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> Hello,
>
> IRA is one of the last passes to recalculate jump labels. With
> Fortran's ASSIGNed GOTO feature, we apparently can end up making
> blocks unreachable this way (and probably a C test case can be
> constructed too).
Ha, I should look at bug comments first. There already *is* a C test case,
void foo (int k)
{
void *label = k ? &&x : &&y;
if (k)
goto *label;
x: y: ;
}
taken from bug 46465. I will add that bug number to the ChangeLog if
the patch is OK.
Ciao!
Steven
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix PR rtl-optimization/46755
2010-12-17 20:53 [PATCH] Fix PR rtl-optimization/46755 Steven Bosscher
2010-12-17 21:04 ` Steven Bosscher
@ 2010-12-18 18:10 ` Vladimir Makarov
1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Makarov @ 2010-12-18 18:10 UTC (permalink / raw)
To: Steven Bosscher; +Cc: GCC Patches
On 12/17/2010 03:38 PM, Steven Bosscher wrote:
> Hello,
>
> IRA is one of the last passes to recalculate jump labels. With
> Fortran's ASSIGNed GOTO feature, we apparently can end up making
> blocks unreachable this way (and probably a C test case can be
> constructed too). This is something to anticipate when
> purge_all_dead_edges() is called. So although it would be interesting
> to find out why the blocks become unreachable so late, I just patched
> the compiler at the location where the ICE occurs. The solution is
> simply to remove all unreachable basic blocks if
> purge_all_dead_edges() nuked some edges.
>
> Bootstrapped&tested on x86_64-unknown-linux-gnu. OK for trunk?
>
>
Ok. Thanks for the patch, Steven.
You can add the test (besides already existing one) if you want. It is
up to you.
> gcc/
> PR rtl-optimization/46755
> * ira.c (ira): If some dead edges were removed, find and delete
> any blocks that might have become unreachable.
>
> testsuite/
> PR rtl-optimization/46755
> * gfortran.dg/pr46755.f: New test
>
> Index: ira.c
> ===================================================================
> --- ira.c (revision 167996)
> +++ ira.c (working copy)
> @@ -3158,7 +3158,8 @@ ira (FILE
> {
> timevar_push (TV_JUMP);
> rebuild_jump_labels (get_insns ());
> - purge_all_dead_edges ();
> + if (purge_all_dead_edges ())
> + delete_unreachable_blocks ();
> timevar_pop (TV_JUMP);
> }
> }
> Index: testsuite/gfortran.dg/pr46755.f
> ===================================================================
> --- testsuite/gfortran.dg/pr46755.f (revision 0)
> +++ testsuite/gfortran.dg/pr46755.f (revision 0)
> @@ -0,0 +1,23 @@
> +C { dg-do compile }
> +C { dg-options "-O" }
> + IMPLICIT NONE
> + INTEGER I640,I760,I800
> + INTEGER I,ITER,ITMX,LENCM
> + LOGICAL QDISK,QDW
> + ASSIGN 801 TO I800
> + GOTO I800
> + 801 CONTINUE
> + ASSIGN 761 TO I760
> + 761 CONTINUE
> + DO I=1,LENCM
> + ENDDO
> + DO WHILE(ITER.LT.ITMX)
> + IF(QDW) THEN
> + ASSIGN 641 to I640
> + GOTO I760
> + 641 CONTINUE
> + ENDIF
> + ENDDO
> + RETURN
> + END
> +
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-12-18 16:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-17 20:53 [PATCH] Fix PR rtl-optimization/46755 Steven Bosscher
2010-12-17 21:04 ` Steven Bosscher
2010-12-18 18:10 ` Vladimir Makarov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).