public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "matz at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/44542] expand_one_stack_var_at may set DECL_ALIGN to a too high value
Date: Tue, 15 Jun 2010 11:19:00 -0000	[thread overview]
Message-ID: <20100615111921.3646.qmail@sourceware.org> (raw)
In-Reply-To: <bug-44542-87@http.gcc.gnu.org/bugzilla/>



------- Comment #1 from matz at gcc dot gnu dot org  2010-06-15 11:19 -------
We have a slightly problematic ordering issue here.  Here's what I
think should be made the case:
  DECL_ALIGN should not matter after expansion, we have MEM_ALIGN for that.
  (and for calculating offsets from stack-ptr we can calculate the
   alignment directly)

If that were the case already we wouldn't have the problem of having to
maintain DECL_ALIGN.  Of course the problem is, that MEM_ALIGN is actually
generated from DECL_ALIGN during expansion itself.  It follows that it
actually wouldn't help at all to fixup only DECL_ALIGN after the final
stack alignment is known.  We would also have to walk all RTL and fixup
MEM_ALIGN too (in possibly non-obvious ways).  If we wouldn't do that
but start with minimal DECL_ALIGN we have only managed to produce very
suboptimal code.  On some architecture even so unoptimal as to use unaligned
instructions were aligned ones would be possible.  And we wouldn't necessarily
be able to fixup _that_ after the fact.

Now, the mentioned ordering problem is, that we align the stack only after
all instructions are converted (and hence all stack-vars are expanded).  We
can't do it before, because the necessity for stack-alignment depends on
the actually emitted stack-vars.  And doing it afterwards will lead to the 
need for walking all instructions again, fixing DECL_ALIGN and MEM_ALIGN
(and changing instructions to use more optimal versions of the alignment
now is somehow better).

I think the only correct way is for expand_stack_alignment to align the
stack exactly so that all DECL_ALIGN and MEM_ALIGN entries are correct.
In other words I think it would be a bug for expand_stack_alignment to
generate an actual stack alignment that would lessen the alignment of
stack vars.

To that effect I think I'd rather want to see a reproducer for 4.5/4.6
and fix the bug in expand_stack_alignment (possibly in the target hooks)
than trying to fiddle with the insn chain.

Weren't there some DRAP fixes after 4.4?  I seem to remember some patches
flying by at that time-frame.  Perhaps you can also create a reproducer
for 4.5 just before expand-from-ssa?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44542


  reply	other threads:[~2010-06-15 11:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15 10:51 [Bug target/44542] New: " jakub at gcc dot gnu dot org
2010-06-15 11:19 ` matz at gcc dot gnu dot org [this message]
2010-06-15 11:37 ` [Bug target/44542] " jakub at gcc dot gnu dot org
2010-06-15 12:53 ` jakub at gcc dot gnu dot org
2010-06-15 13:41 ` matz at gcc dot gnu dot org
2010-06-15 13:51 ` matz at gcc dot gnu dot org
2010-06-15 14:47 ` hjl dot tools at gmail dot com
2010-06-15 14:56 ` matz at gcc dot gnu dot org
2010-06-15 15:39 ` hjl dot tools at gmail dot com
2010-06-15 16:46 ` jakub at gcc dot gnu dot org
2010-06-15 17:13 ` hjl dot tools at gmail dot com
2010-06-15 17:20 ` hjl dot tools at gmail dot com
2010-06-15 17:25 ` hjl dot tools at gmail dot com
2010-06-16  6:56 ` jakub at gcc dot gnu dot org
2010-06-16 14:36 ` hjl dot tools at gmail dot com
2010-06-16 14:58 ` jakub at gcc dot gnu dot org
2010-06-16 15:38 ` hjl dot tools at gmail dot com
2010-07-27 17:55 ` jakub at gcc dot gnu dot org
2010-07-27 18:00 ` jakub at gcc dot gnu dot org
2010-09-17 20:25 ` hjl dot tools at gmail dot com

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=20100615111921.3646.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).