public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/49279] [4.5/4.6/4.7 Regression] Optimization incorrectly presuming constant variable inside loop in g++ 4.5 and 4.6 with -O2 and -O3 for x86_64 targets
Date: Tue, 04 Oct 2011 16:48:00 -0000	[thread overview]
Message-ID: <bug-49279-4-VKesak46Qj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-49279-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-10-04 16:47:22 UTC ---
Looking at this (don't see how this is related to the other PR), I think the
bug is either that we have these TYPE_RESTRICT casts (caused by storing a
non-restricted pointer into a restricted field) in the IL at all, or that we
are propagating the restrict tags through the restricted field which we have
decided not to have a restrict tag for.  If it is a field that can have a
restrict tag safely attached to it (restrict field in a structure argument, or
DECL_BY_REFERENCE/restrict REFERENCE_TYPE argument pointed structure, or global
variable field, or perhaps automatic variable without address taken, the casts
for store to it should either not have (restr) at all, or at least should use
the same restrict tag as the field.  But if the field can't have safely a
restrict tag, if we make it up because of the casts for store to it, different
stores might be with different tags and if two different pointers alias and PTA
doesn't figure it out, we have expressions based on the same restricted field
with different restrict tags and miscompile.

Now the question is how to safely find out what is a cast for store from other
casts.  TYPE_RESTRICT casts from non-restrict pointers feeding one stmt which
stores it into restricted field?  Or should we just say such casts shouldn't be
in the IL?  Or should only TYPE_RESTRICT casts to SSA_NAMEs of non-artificial
vars be considered?

In the testcase, all the __restrict casts are casts for store into some field
that can't have safely a restrict tag attached:
  # PT = nonlocal escaped { D.7761 } (restr)
  data.11D.7427_92 = (const ScalarD.4717 * restrict) D.7426_91;
  # .MEMD.7374_151 = VDEF <.MEMD.7374_52>
  MEM[(struct MapBaseD.4571 *)&D.4884].m_dataD.4766 = data.11D.7427_92;


  parent reply	other threads:[~2011-10-04 16:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-03 21:23 [Bug c++/49279] New: " tcmartins at gmail dot com
2011-06-04 16:37 ` [Bug c++/49279] " hjl.tools at gmail dot com
2011-06-06  9:06 ` [Bug c++/49279] [4.5/4.6/4.7 Regression] " rguenth at gcc dot gnu.org
2011-06-06 13:01 ` rguenth at gcc dot gnu.org
2011-06-06 14:04 ` rguenth at gcc dot gnu.org
2011-08-01 14:03 ` rguenth at gcc dot gnu.org
2011-10-04 16:48 ` jakub at gcc dot gnu.org [this message]
2011-10-04 16:59 ` [Bug tree-optimization/49279] " jakub at gcc dot gnu.org
2011-10-05  8:09 ` jakub at gcc dot gnu.org
2011-10-05  9:06 ` jakub at gcc dot gnu.org
2011-10-05  9:43 ` rguenther at suse dot de
2011-10-05 14:39 ` rguenth at gcc dot gnu.org
2011-10-05 15:51 ` jakub at gcc dot gnu.org
2011-10-05 15:53 ` jakub at gcc dot gnu.org
2011-10-06  8:08 ` rguenth at gcc dot gnu.org
2011-10-06  8:10 ` rguenth at gcc dot gnu.org
2011-10-06 16:39 ` jakub at gcc dot gnu.org
2011-10-06 19:58 ` jakub at gcc dot gnu.org
2011-10-07  8:16 ` [Bug tree-optimization/49279] [4.5 " rguenth at gcc dot gnu.org
2011-10-12 15:27 ` matz at gcc dot gnu.org
2012-01-03 12:21 ` rguenth at gcc dot gnu.org
2012-01-03 13:56 ` rguenth at gcc dot gnu.org
2012-01-03 14:05 ` rguenth at gcc dot gnu.org

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-49279-4-VKesak46Qj@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).