public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/67701] Unnecessary/bad instructions for u32-casted access to external symbol (assumes misaligned, superfluous load)
Date: Fri, 25 Sep 2015 07:38:00 -0000 [thread overview]
Message-ID: <bug-67701-4-xPv2zvTXdZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-67701-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67701
--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 24 Sep 2015, ebotcazou at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67701
>
> --- Comment #7 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> > Yes, AFAIK this was some obscure situation with SSE on x86. IIRC
> > code doing unaligned scalar accesses (which is ok on x86) but then
> > vectorized using peeling for alignment (which cannot succeed if the
> > element is not naturally aligned) and segfaulting for the emitted
> > aligned move instructions.
>
> I see, thanks for the insight.
>
> > Maybe these days the legacy has been cleaned up enough so we can
> > remove that conservative handling again... I think it also causes
> > us to handle
> >
> > char c[4];
> >
> > int main()
> > {
> > if (!((unsigned long)c & 3))
> > return *(int *)c;
> > return c[0];
> > }
> >
> > too conservatively as we expand
> >
> > _5 = MEM[(int *)&c];
> >
> > and thus lost the flow-sensitive info.
>
> The problem is that, in order to fix a legitimate issue on x86, the change
> pessimizes the code for strict-alignment platforms, where the said issue
> doesn't exist since there are unaligned accesses in the source code. And of
> course only for them, since x86 has unaligned load/stores. So, in the end,
> this is a net loss for strict-alignment platforms.
Agreed. Looking at how to fix this in get_object_alignment_2 I wonder
if it makes sense to unify this function with get_inner_reference. The
other choice would be to add a flag to get_inner_reference to stop
at MEM_REF/TARGET_MEM_REFs.
prev parent reply other threads:[~2015-09-25 7:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-23 23:56 [Bug c/67701] New: " jwerner at chromium dot org
2015-09-24 0:03 ` [Bug c/67701] " jwerner at chromium dot org
2015-09-24 0:28 ` [Bug target/67701] " pinskia at gcc dot gnu.org
2015-09-24 1:37 ` jwerner at chromium dot org
2015-09-24 7:48 ` rguenth at gcc dot gnu.org
2015-09-24 13:53 ` ebotcazou at gcc dot gnu.org
2015-09-24 14:09 ` rguenther at suse dot de
2015-09-24 15:14 ` ebotcazou at gcc dot gnu.org
2015-09-25 7:38 ` rguenther at suse dot de [this message]
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=bug-67701-4-xPv2zvTXdZ@http.gcc.gnu.org/bugzilla/ \
--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).