From: Jakub Jelinek <jakub@redhat.com>
To: Andreas Krebbel <krebbel@linux.ibm.com>
Cc: Jeff Law <law@redhat.com>, Eric Botcazou <ebotcazou@adacore.com>,
Richard Biener <richard.guenther@gmail.com>,
GCC Patches <gcc-patches@gcc.gnu.org>,
Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Subject: Re: [PATCH] PR86844: Fix for store merging
Date: Mon, 10 Sep 2018 17:53:00 -0000 [thread overview]
Message-ID: <20180910175332.GP3826@laptop.zalov.cz> (raw)
In-Reply-To: <8d5e4bd1-e42b-111e-29d2-67a5206ba315@linux.ibm.com>
On Mon, Sep 10, 2018 at 04:05:26PM +0200, Andreas Krebbel wrote:
> On 20.08.2018 16:30, Jeff Law wrote:
> > On 08/18/2018 03:20 AM, Eric Botcazou wrote:
> >>> Eric, didn't your patches explicitely handle this case of a non-constant
> >>> inbetween?
> >>
> >> Only if there is no overlap at all, otherwise you cannot do things simply.
> >>
> >>> Can you have a look / review here?
> >>
> >> Jakub is probably more qualified to give a definitive opinion, as he wrote
> >> check_no_overlap and the bug is orthogonal to my patches since it is present
> >> in 8.x; in any case, all transformations are supposed to be covered by the
> >> testsuite.
> > FYI. Jakub is on PTO through the end of this week and will probably be
> > buried when he returns.
>
> Jakub, could you please have a look whether that's the right fix?
>
> https://gcc.gnu.org/ml/gcc-patches/2018-08/msg00474.html
It is a fix, but not optimal.
We have essentially:
MEM[(int *)p_28] = 0;
MEM[(char *)p_28 + 3B] = 1;
MEM[(char *)p_28 + 1B] = 2;
MEM[(char *)p_28 + 2B] = MEM[(char *)p_28 + 6B];
It is useful to merge the first 3 stores into:
MEM[(int *)p_28] = 0x01000200; // or 0x00020001; depending on endianity
MEM[(char *)p_28 + 2B] = MEM[(char *)p_28 + 6B];
rather than punt, and just ignore (i.e. make sure it isn't merged with
anything else) the non-INTEGER_CST store). If you don't mind, I'll take this
PR over and handle it tomorrow.
Slightly tweaked testcase:
__attribute__((noipa)) void
foo (int *p)
{
*p = 0;
*((char *)p + 3) = 1;
*((char *)p + 1) = 2;
*((char *)p + 2) = *((char *)p + 6);
}
int
main ()
{
int a[2] = { -1, 0 };
if (sizeof (int) != 4)
return 0;
((char *)a)[6] = 3;
foo (a);
if (((char *)a)[0] != 0 || ((char *)a)[1] != 2
|| ((char *)a)[2] != 3 || ((char *)a)[3] != 1)
__builtin_abort ();
}
Jakub
next prev parent reply other threads:[~2018-09-10 17:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-07 11:35 Andreas Krebbel
2018-08-17 13:50 ` Richard Biener
2018-08-18 9:20 ` Eric Botcazou
2018-08-20 14:30 ` Jeff Law
2018-09-10 14:06 ` Andreas Krebbel
2018-09-10 17:53 ` Jakub Jelinek [this message]
2018-09-11 14:06 ` Andreas Krebbel
2018-09-12 8:54 ` [PATCH] Fix store merging (PR tree-optimization/86844) Jakub Jelinek
2018-09-12 9:04 ` Richard Biener
2018-09-12 9:11 ` Jakub Jelinek
2018-09-12 11:02 ` Richard Biener
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=20180910175332.GP3826@laptop.zalov.cz \
--to=jakub@redhat.com \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=krebbel@linux.ibm.com \
--cc=krebbel@linux.vnet.ibm.com \
--cc=law@redhat.com \
--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).