public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/30567] [4.2 Regression] -O3 optimizer bug
Date: Wed, 25 Apr 2007 13:22:00 -0000	[thread overview]
Message-ID: <20070425132213.24992.qmail@sourceware.org> (raw)
In-Reply-To: <bug-30567-3137@http.gcc.gnu.org/bugzilla/>



------- Comment #26 from rguenth at gcc dot gnu dot org  2007-04-25 14:22 -------
We fail to add the SFTs to the may_alias set of SMT.11, so add_virtual_operand
sees NULL may_aliases and doesn't add SFTs as clobbered.

I believe compute_flow_insensitive_aliasing is the culprit here as one can
easily
see that if we enter the

  for (i = 0; i < ai->num_pointers; i++)
    {
      size_t j;
      struct alias_map_d *p_map1 = ai->pointers[i];
      tree tag1 = var_ann (p_map1->var)->symbol_mem_tag;
      bitmap may_aliases1 = p_map1->may_aliases;

      if (PTR_IS_REF_ALL (p_map1->var))
        continue;

      for (j = i + 1; j < ai->num_pointers; j++)
        {
          struct alias_map_d *p_map2 = ai->pointers[j];
          tree tag2 = var_ann (p_map2->var)->symbol_mem_tag;
          bitmap may_aliases2 = p_map2->may_aliases;


loop with may_aliases2 empty it will stay so.  So as a fix I suggest to
add may aliases symmetrically like with

Index: tree-ssa-alias.c
===================================================================
*** tree-ssa-alias.c    (revision 124151)
--- tree-ssa-alias.c    (working copy)
*************** compute_flow_insensitive_aliasing (struc
*** 1287,1292 ****
--- 1287,1294 ----
          struct alias_map_d *p_map2 = ai->pointers[j];
          tree tag2 = var_ann (p_map2->var)->symbol_mem_tag;
          bitmap may_aliases2 = p_map2->may_aliases;
+         unsigned int k;
+         bitmap_iterator bi;

          if (PTR_IS_REF_ALL (p_map2->var))
            continue;
*************** compute_flow_insensitive_aliasing (struc
*** 1301,1323 ****
            continue;

          if (!bitmap_empty_p (may_aliases2))
!           {
!             unsigned int k;
!             bitmap_iterator bi;
! 
!             /* Add all the aliases for TAG2 into TAG1's alias set.
!                FIXME, update grouping heuristic counters.  */
!             EXECUTE_IF_SET_IN_BITMAP (may_aliases2, 0, k, bi)
!               add_may_alias (tag1, referenced_var (k));
!             bitmap_ior_into (may_aliases1, may_aliases2);
!           }
          else
!           {
!             /* Since TAG2 does not have any aliases of its own, add
!                TAG2 itself to the alias set of TAG1.  */
!             add_may_alias (tag1, tag2);
!             bitmap_set_bit (may_aliases1, DECL_UID (tag2));
!           }
        }
      }

--- 1303,1325 ----
            continue;

          if (!bitmap_empty_p (may_aliases2))
!           /* Add all the aliases for TAG2 into TAG1's alias set.
!              FIXME, update grouping heuristic counters.  */
!           EXECUTE_IF_SET_IN_BITMAP (may_aliases2, 0, k, bi)
!             add_may_alias (tag1, referenced_var (k));
!         else
!           add_may_alias (tag1, tag2);
! 
!         if (!bitmap_empty_p (may_aliases1))
!           /* Add all the aliases for TAG2 into TAG1's alias set.
!              FIXME, update grouping heuristic counters.  */
!           EXECUTE_IF_SET_IN_BITMAP (may_aliases1, 0, k, bi)
!             add_may_alias (tag2, referenced_var (k));
          else
!           add_may_alias (tag2, tag1);
! 
!         bitmap_ior_into (may_aliases2, may_aliases1);
!         bitmap_ior_into (may_aliases1, may_aliases2);
        }
      }



but I have no clue what I am doing here.  't looks like big mess.

I prepare the workaround as alternative ;)


-- 


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


  parent reply	other threads:[~2007-04-25 13:22 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-24  0:08 [Bug c++/30567] New: -fPIC -O3 optimizer bug (32-bit target only) rwgk at yahoo dot com
2007-01-24  0:10 ` [Bug c++/30567] " rwgk at yahoo dot com
2007-01-24  6:57 ` pinskia at gcc dot gnu dot org
2007-01-28 20:03 ` rwgk at yahoo dot com
2007-02-03 20:42 ` rwgk at yahoo dot com
2007-02-11  4:08 ` bangerth at dealii dot org
2007-02-11  5:30 ` rwgk at yahoo dot com
2007-02-12  0:02 ` bangerth at dealii dot org
2007-02-12  5:23 ` rwgk at yahoo dot com
2007-02-12 15:48 ` rwgk at yahoo dot com
2007-02-12 16:03 ` bangerth at dealii dot org
2007-02-12 16:37 ` dberlin at gcc dot gnu dot org
2007-02-26  2:26 ` rwgk at yahoo dot com
2007-02-26  2:42 ` dberlin at dberlin dot org
2007-02-26  3:37 ` rwgk at yahoo dot com
2007-02-26  4:38 ` dberlin at gcc dot gnu dot org
2007-02-26  7:55 ` rwgk at yahoo dot com
2007-02-26 18:41 ` bangerth at dealii dot org
2007-04-18 19:00 ` hjl at lucon dot org
2007-04-18 19:02 ` hjl at lucon dot org
2007-04-18 20:47 ` hjl at lucon dot org
2007-04-18 21:11 ` [Bug c++/30567] -fPIC -O3 optimizer bug hjl at lucon dot org
2007-04-18 21:47 ` [Bug c++/30567] " rguenth at gcc dot gnu dot org
2007-04-18 21:56 ` [Bug tree-optimization/30567] " rguenth at gcc dot gnu dot org
2007-04-21 17:08 ` [Bug tree-optimization/30567] [4.2 Regression] " rguenth at gcc dot gnu dot org
2007-04-21 17:38 ` rguenth at gcc dot gnu dot org
2007-04-24 20:37 ` mmitchel at gcc dot gnu dot org
2007-04-25  2:14 ` dberlin at gcc dot gnu dot org
2007-04-25 13:22 ` rguenth at gcc dot gnu dot org [this message]
2007-04-25 13:43 ` rguenth at gcc dot gnu dot org
2007-04-25 14:04 ` rguenth at gcc dot gnu dot org
2007-04-25 15:32 ` rguenth at gcc dot gnu dot org
2007-04-25 15:42 ` rguenth at gcc dot gnu dot org
2007-04-25 16:01 ` dberlin at dberlin dot org
2007-04-25 16:13 ` rguenth at gcc dot gnu dot org
2007-04-25 18:45 ` dberlin at gcc dot gnu dot org
2007-04-26  9:02 ` rguenth at gcc dot gnu dot org
2007-04-26 11:16 ` rguenth at gcc dot gnu dot org
2007-04-26 11:16 ` rguenth at gcc dot gnu dot org
2007-04-26 15:50 ` rguenth at gcc dot gnu dot 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=20070425132213.24992.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).