This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: basic block reordering + java


> > 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;
  }
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]