This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: basic block reordering + java
- To: Jan Hubicka <jh at suse dot cz>, gcc-patches at gcc dot gnu dot org
- Subject: Re: basic block reordering + java
- From: Jan Hubicka <jh at suse dot cz>
- Date: Mon, 24 Sep 2001 13:49:40 +0200
- Cc: Anthony Green <green at redhat dot com>, "Gcc at Gcc dot Gnu. Org" <gcc at gcc dot gnu dot org>, "Java at Gcc dot Gnu. Org" <java at gcc dot gnu dot org>
- References: <005601c142aa$039ed920$5be6b4cd@cygnus.com> <20010922174345.F26663@atrey.karlin.mff.cuni.cz>
> > With basic block reordering, we often see code from gcj that ends in...
> >
> > .L20:
> > call _Jv_ThrowNullPointerException
> > .L21:
> > call _Jv_ThrowNullPointerException
> > .L22:
> > call _Jv_ThrowNullPointerException
> > .L23:
> > call _Jv_ThrowNullPointerException
> > .L24:
> > call _Jv_ThrowNullPointerException
> > .L25:
> > call _Jv_ThrowNullPointerException
> > .L26:
> > call _Jv_ThrowNullPointerException
> >
> > Is there an easy way for GCC to merge identical blocks?
> Oh yes, all you need is to modify crossjumping to add fake "noreturn"
> edges and crossjump over them.
> I can try to get that working later, but right now I am quite busy by other
> thinks.
Done.
Hi,
this patch adds support for crossjumping of noreturn calls.
For instance in:
int a,b;
main()
{
if (a)
abort ();
if (b)
abort ();
}
Only single abort call is emit now.
Bootstrapped/regtested i386
Sat Sep 22 17:08:26 CEST 2001 Jan Hubicka <jh@suse.cz>
* cfgcleanup.c (try_optimize_cfg): Add fake exit edges for noreturn
calls when crossjumping.
*** /p2/cfg9/egcs/gcc/cfgcleanup.c Thu Sep 20 18:33:13 2001
--- cfgcleanup.c Sat Sep 22 14:19:55 2001
*************** try_optimize_cfg (mode)
*** 1032,1037 ****
--- 1027,1035 ----
bool changed;
int iterations = 0;
+ if (mode & CLEANUP_CROSSJUMP)
+ add_noreturn_fake_exit_edges ();
+
/* Attempt to merge blocks as made possible by edge removal. If a block
has only one successor, and the successor has only one predecessor,
they may be combined. */
*************** try_optimize_cfg (mode)
*** 1162,1167 ****
--- 1160,1169 ----
changed_overall |= changed;
}
while (changed);
+
+ if (mode & CLEANUP_CROSSJUMP)
+ remove_fake_edges ();
+
return changed_overall;
}