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]
Other format: [Raw text]

Re: [PATCH] Make gsi_remove return whether EH cleanup is required


On Thu, 5 Apr 2012, Rainer Orth wrote:

> Richard Guenther <richard.guenther@gmail.com> writes:
> 
> > On Thu, Apr 5, 2012 at 1:20 PM, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
> >> Richard Guenther <rguenther@suse.de> writes:
> >>
> >>> Several passes needlessly cleanup EH after gsi_remove because they do
> >>> not know whether the stmt was removed from EH regions. ?The following
> >>> patch returns this information from gsi_remove and adjusts all users
> >>> I could find appropriately.
> >>
> >> I suspect this patch caused a go1 SEGV compiling the non-PIC
> >> libgo/exp/norm.o on i386-pc-solaris2.10:
> >
> > Ah.  Try
> >
> > Index: gcc/tree-ssa-dse.c
> > ===================================================================
> > --- gcc/tree-ssa-dse.c  (revision 186161)
> > +++ gcc/tree-ssa-dse.c  (working copy)
> > @@ -232,6 +232,8 @@ dse_optimize_stmt (gimple_stmt_iterator
> >                                 gimple_get_lhs (use_stmt), 0)))
> >           || stmt_kills_ref_p (use_stmt, gimple_assign_lhs (stmt)))
> >         {
> > +         basic_block bb;
> > +
> >           /* If use_stmt is or might be a nop assignment, e.g. for
> >              struct { ... } S a, b, *p; ...
> >              b = a; b = b;
> > @@ -258,8 +260,9 @@ dse_optimize_stmt (gimple_stmt_iterator
> >           unlink_stmt_vdef (stmt);
> >
> >           /* Remove the dead store.  */
> > +         bb = gimple_bb (stmt);
> >           if (gsi_remove (&gsi, true))
> > -           bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index);
> > +           bitmap_set_bit (need_eh_cleanup, bb->index);
> >
> >           /* And release any SSA_NAMEs set in this statement back to the
> >              SSA_NAME manager.  */
> >
> 
> Works fine on x86_64-unknown-linux-gnu, where the failure happened as
> well.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2012-04-05  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-dse.c (dse_optimize_stmt): Remember the stmt
	basic-block before removing it.

Index: gcc/tree-ssa-dse.c
===================================================================
--- gcc/tree-ssa-dse.c	(revision 186161)
+++ gcc/tree-ssa-dse.c	(working copy)
@@ -232,6 +232,8 @@ dse_optimize_stmt (gimple_stmt_iterator
 				gimple_get_lhs (use_stmt), 0)))
 	  || stmt_kills_ref_p (use_stmt, gimple_assign_lhs (stmt)))
 	{
+	  basic_block bb;
+
 	  /* If use_stmt is or might be a nop assignment, e.g. for
 	     struct { ... } S a, b, *p; ...
 	     b = a; b = b;
@@ -258,8 +260,9 @@ dse_optimize_stmt (gimple_stmt_iterator
 	  unlink_stmt_vdef (stmt);
 
 	  /* Remove the dead store.  */
+	  bb = gimple_bb (stmt);
 	  if (gsi_remove (&gsi, true))
-	    bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index);
+	    bitmap_set_bit (need_eh_cleanup, bb->index);
 
 	  /* And release any SSA_NAMEs set in this statement back to the
 	     SSA_NAME manager.  */

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