public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: Richard Henderson <rth@redhat.com>
Cc: gcc-patches@gcc.gnu.org, Richard Guenther <rguenther@suse.de>,
		Jakub Jelinek <jakub@redhat.com>
Subject: Re: [PATCH, alpha]: Fix PR target/41089, stdarg pass produces wrong 	code
Date: Mon, 02 Aug 2010 17:24:00 -0000	[thread overview]
Message-ID: <AANLkTin-0-1G5n6ocy5LLawtAQJsCHpD3u1PMFWmvA+E@mail.gmail.com> (raw)
In-Reply-To: <4C56F982.2000908@redhat.com>

On Mon, Aug 2, 2010 at 6:59 PM, Richard Henderson <rth@redhat.com> wrote:

>> As discussed in the PR, stdarg pass depends on number of assignments
>> to ap.__offset location for correct operation. However, recent FRE/DCE
>> enhancements remove one assignment as a dead code, causing the test
>> failure:
>>
>> FAIL: gcc.c-torture/execute/stdarg-1.c execution,  -O3 -fomit-frame-pointer
>> FAIL: gcc.c-torture/execute/stdarg-1.c execution,  -O3 -g
>>
>> Attached patch marks __offset as volatile (suggested by Richi in
>> comment #39), preventing optimizations that could otherwise confuse
>> stdarg pass.
>>
>> 2010-08-01  Uros Bizjak  <ubizjak@gmail.com>
>>
>>       PR target/41089
>>       * config/alpha/alpha.c (alpha_build_builtin_va_list): Mark __offset
>>       as volatile.
>>
>> Patch was bootstrapped and regression tested on
>> alphaev68-pc-linux-gnu, where it fixes the failure.
>
> Ug.  That's awful.  It means that when you really do have dead code
> it won't get deleted, and thus the stdarg pass won't be able to
> eliminate the stores that could have been prevented.
>
> I'm tempted to say just remove the entire optimization, but what's
> left after the volatile may be slightly better than no optimization
> at all -- i.e. we can determine that there were never any va_arg
> requests for double at all.
>
> So... patch ok.

Thanks. I have committed the patch with a comment:

Index: alpha.c
===================================================================
--- alpha.c	(revision 162825)
+++ alpha.c	(working copy)
@@ -5950,6 +5950,10 @@
 		    integer_type_node);
   DECL_FIELD_CONTEXT (ofs) = record;
   DECL_CHAIN (ofs) = space;
+  /* ??? This is a hack, __offset is marked volatile to prevent
+     DCE that confuses stdarg optimization and results in
+     gcc.c-torture/execute/stdarg-1.c failure.  See PR 41089.  */
+  TREE_THIS_VOLATILE (ofs) = 1;

   base = build_decl (BUILTINS_LOCATION,
 		     FIELD_DECL, get_identifier ("__base"),

Uros.

  reply	other threads:[~2010-08-02 17:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-01 18:44 Uros Bizjak
2010-08-02 16:59 ` Richard Henderson
2010-08-02 17:24   ` Uros Bizjak [this message]
2010-08-03  8:43     ` Richard Guenther

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=AANLkTin-0-1G5n6ocy5LLawtAQJsCHpD3u1PMFWmvA+E@mail.gmail.com \
    --to=ubizjak@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.de \
    --cc=rth@redhat.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).