public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@libertysurf.fr>
To: Mark Mitchell <mark@codesourcery.com>
Cc: gcc@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: GCC Status Report (2004-03-09)
Date: Thu, 18 Mar 2004 18:31:00 -0000	[thread overview]
Message-ID: <200403181927.00513.ebotcazou@libertysurf.fr> (raw)
In-Reply-To: <200403180924.19533.ebotcazou@libertysurf.fr>

[-- Attachment #1: Type: text/plain, Size: 805 bytes --]

> 2004-03-18  Eric Botcazou <ebotcazou@libertysurf.fr>
>             Mark Mitchell <mark@codesourcery.com>
>
> 	PR optimization/13424
> 	* expr.c (store_constructor): Emit a blockage after clearing the
> 	aggregate because of an incomplete or mostly zero constructor.

Well, this pessimizes way too much.  We can emit the blockage only in the 
unsafe cases:


 2004-03-18  Eric Botcazou <ebotcazou@libertysurf.fr>
             Mark Mitchell <mark@codesourcery.com>

 	PR optimization/13424
 	* expr.c (store_constructor): Emit a blockage after clearing the
 	aggregate because of an incomplete or mostly zero constructor if
	the aggregate contains read-only fields.


But this would still pessimize a lot, because life analysis would not be able 
to delete the redundant writes anymore.

-- 
Eric Botcazou

[-- Attachment #2: pr13424-3.diff --]
[-- Type: text/x-diff, Size: 1464 bytes --]

Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.615.4.9
diff -u -p -r1.615.4.9 expr.c
--- expr.c	13 Mar 2004 18:26:23 -0000	1.615.4.9
+++ expr.c	18 Mar 2004 18:14:18 -0000
@@ -4551,8 +4551,9 @@ store_constructor (tree exp, rtx target,
 		       == size)))
 	{
 	  rtx xtarget = target;
+	  bool partly_readonly_p = readonly_fields_p (type);
 
-	  if (readonly_fields_p (type))
+	  if (partly_readonly_p)
 	    {
 	      xtarget = copy_rtx (xtarget);
 	      RTX_UNCHANGING_P (xtarget) = 1;
@@ -4560,6 +4561,19 @@ store_constructor (tree exp, rtx target,
 
 	  clear_storage (xtarget, GEN_INT (size));
 	  cleared = 1;
+
+	  /* ??? Emit a blockage to prevent the scheduler from swapping the
+	     memory write issued just above and the memory write that may be
+	     issued below to initialize each field.  This is needed for a
+	     read-write field because the former write may carry the /u
+	     flag and not the latter, so they will not conflict.  Note that
+	     the clearing cannot be simply disabled in the unsafe cases
+	     because the C front-end relies on it to implement the semantics
+	     of constructors for automatic objects.
+	     However, not all machine descriptions define a blockage insn,
+	     so emit an ASM_INPUT to act as one.  */
+	  if (partly_readonly_p)
+	    emit_insn (gen_rtx_ASM_INPUT (VOIDmode, ""));
 	}
 
       if (! cleared)

  reply	other threads:[~2004-03-18 18:23 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-09 18:09 Mark Mitchell
2004-03-11  9:45 ` Eric Botcazou
2004-03-11 12:48   ` Jakub Jelinek
2004-03-11 21:11     ` Richard Henderson
2004-03-16 16:53   ` Mark Mitchell
2004-03-16 16:59     ` Paul Koning
2004-03-16 17:11       ` Ian Lance Taylor
2004-03-16 17:24         ` Zack Weinberg
2004-03-16 17:25           ` Paul Koning
2004-03-17 10:56     ` Eric Botcazou
2004-03-17 11:49       ` Eric Botcazou
2004-03-17 15:55       ` Mark Mitchell
2004-03-18  8:25         ` Eric Botcazou
2004-03-18 18:31           ` Eric Botcazou [this message]
2004-03-18 19:15             ` Mark Mitchell
2004-03-18 23:36               ` Eric Botcazou
2004-03-18 23:41                 ` Jakub Jelinek
2004-03-19  1:23                   ` Eric Botcazou
2004-03-19 14:31                   ` Eric Botcazou
2004-03-19 19:29                     ` Mark Mitchell
2004-03-19 20:04                       ` Eric Botcazou
2004-03-19 20:23                         ` Mark Mitchell
2004-03-20 19:51                           ` Eric Botcazou
     [not found]                 ` <405A3F26.2050100@codesourcery.com>
     [not found]                   ` <200403190155.18981.ebotcazou@libertysurf.fr>
2004-03-19  6:42                     ` Mark Mitchell
2004-03-16  2:09 ` C++ status (Was: GCC Status Report (2004-03-09)) Giovanni Bajo
2004-03-11 12:15 GCC Status Report (2004-03-09) Richard Kenner
2004-03-11 12:39 ` Eric Botcazou
2004-03-11 12:49 Richard Kenner
2004-03-11 14:09 ` Eric Botcazou
2004-03-19  6:34 Richard Kenner
2004-03-19 12:18 ` Jakub Jelinek
2004-03-19 14:22 Richard Kenner
2004-03-19 20:08 Richard Kenner

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=200403181927.00513.ebotcazou@libertysurf.fr \
    --to=ebotcazou@libertysurf.fr \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=mark@codesourcery.com \
    /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).