public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Matz <matz@suse.de>
To: Richard Biener <richard.guenther@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>, Jan Hubicka <hubicka@ucw.cz>
Subject: Re: [RFC, PR 80689] Copy small aggregates element-wise
Date: Mon, 13 Nov 2017 15:33:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.21.1711131513120.25295@wotan.suse.de> (raw)
In-Reply-To: <CAFiYyc1-QTCj48bDd8fBUD_ebjUmQ0wvYchZgauZWbyKGzAVUQ@mail.gmail.com>

Hi,

On Mon, 13 Nov 2017, Richard Biener wrote:

> The chance here is, of course (find the PR, it exists...), that SRA then 
> decomposes the char[] copy bytewise...
> 
> That said, memcpy folding is easy to fix.  The question is of course
> what the semantic of VIEW_CONVERTs is (SRA _does_ contain
> bail-outs on those).  Like if you have
> 
> struct A { short s; int i; } x;
> struct B { int i; short s; } y;
> 
> void foo ()
> {
>   x = VIEW_CONVERT <struct A> (y);
> }
> 
> so can you access padding via view-converting its value?  Ada uses 
> VIEW_CONVERT punning on structures a _lot_ (probably the reason for the 
> SRA bailout).

I would say a VIEW_CONVERT shouldn't be allowed to inspect padding on the 
RHS (and expected to clobber padding on the LHS).  That is, if you want to 
really really access padding on some struct type you can only use memcpy.  
(Or view-convert it to some char[N] array, perhaps there it makes sense to 
copy padding, i.e. regard that as a block copy).

The above example shows why I'm of this opinion.  Both structs have 
padding at different place, and it overlaps a member in the other 
struct.  I don't see how to give that any sane meaning (beyond always 
handling it as block copy, and which point we can as well give up and get 
rid of VIEW_CONVERT_EXPR in favor of explicit memcpy).


Ciao,
Michael.

  reply	other threads:[~2017-11-13 14:20 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13 16:31 Martin Jambor
2017-10-17 11:44 ` Richard Biener
2017-10-26 12:23   ` Martin Jambor
2017-10-26 12:44     ` Richard Biener
2017-10-26 12:57       ` Jan Hubicka
2017-10-26 14:53         ` Richard Biener
2017-10-26 15:12           ` Richard Biener
2017-11-03 16:38             ` Martin Jambor
2017-11-13 13:17               ` Richard Biener
2017-11-13 13:54                 ` Michael Matz
2017-11-13 14:19                   ` Richard Biener
2017-11-13 15:33                     ` Michael Matz [this message]
2017-11-13 16:30                       ` Richard Biener
2017-11-14  0:32                     ` Eric Botcazou
2017-11-23 16:02                 ` Martin Jambor
2017-11-23 16:29                   ` Jakub Jelinek
2017-11-24 10:47                   ` Richard Biener
2017-11-24 11:22                     ` Richard Biener
2017-11-24 11:30                       ` Richard Biener
2017-11-24 12:04                         ` Martin Jambor
2017-11-24 12:06                           ` Richard Biener
2017-11-24 13:31                             ` Martin Jambor
2017-11-24 14:16                               ` Richard Biener
2017-11-14 10:25               ` Martin Jambor
2017-10-27 12:27           ` Jan Hubicka
2017-10-26 14:18     ` Michael Matz

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.LSU.2.21.1711131513120.25295@wotan.suse.de \
    --to=matz@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=richard.guenther@gmail.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).