public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Move MODIFIED_NORETURN_CALLS queueing
Date: Fri, 08 Apr 2011 13:14:00 -0000	[thread overview]
Message-ID: <alpine.LNX.2.00.1104081512130.810@zhemvz.fhfr.qr> (raw)


This moves queueing calls to MODIFIED_NORETURN_CALLS from 
gimple_set_modified to update_stmt_operands.  The former is called
when we remove stmts and thus the call may reference freed SSA names
which doesn't make gimple_call_noreturn_p happy (and in fact we have
a kludge to avoid ICEing here).  At the latter point we are sure
the stmt is still meaningful, so that's a much better point to
queue it.  We are also sure we'll call update_stmt eventually on
all modified stmts which makes this movement safe as well.

Bootstrapped on x86_64-unknown-linux-gnu, regtests in progress.  Will
commit if that succeeds.

Richard.

2011-04-08  Richard Guenther  <rguenther@suse.de>

	* gimple.c (gimple_set_modified): Do not queue calls to
	MODIFIED_NORETURN_CALLS here ...
	* tree-ssa-operands.c (update_stmt_operands): ... but here.

Index: gcc/gimple.c
===================================================================
*** gcc/gimple.c	(revision 172170)
--- gcc/gimple.c	(working copy)
*************** void
*** 2252,2266 ****
  gimple_set_modified (gimple s, bool modifiedp)
  {
    if (gimple_has_ops (s))
!     {
!       s->gsbase.modified = (unsigned) modifiedp;
! 
!       if (modifiedp
! 	  && cfun->gimple_df
! 	  && is_gimple_call (s)
! 	  && gimple_call_noreturn_p (s))
! 	VEC_safe_push (gimple, gc, MODIFIED_NORETURN_CALLS (cfun), s);
!     }
  }
  
  
--- 2252,2258 ----
  gimple_set_modified (gimple s, bool modifiedp)
  {
    if (gimple_has_ops (s))
!     s->gsbase.modified = (unsigned) modifiedp;
  }
  
  
Index: gcc/tree-ssa-operands.c
===================================================================
*** gcc/tree-ssa-operands.c	(revision 172170)
--- gcc/tree-ssa-operands.c	(working copy)
*************** update_stmt_operands (gimple stmt)
*** 1134,1139 ****
--- 1134,1145 ----
  
    timevar_push (TV_TREE_OPS);
  
+   /* If the stmt is a noreturn call queue it to be processed by
+      split_bbs_on_noreturn_calls during cfg cleanup.  */
+   if (is_gimple_call (stmt)
+       && gimple_call_noreturn_p (stmt))
+     VEC_safe_push (gimple, gc, MODIFIED_NORETURN_CALLS (cfun), stmt);
+ 
    gcc_assert (gimple_modified_p (stmt));
    build_ssa_operands (stmt);
    gimple_set_modified (stmt, false);

                 reply	other threads:[~2011-04-08 13:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.00.1104081512130.810@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).