public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/66142] Loop is not vectorized because not sufficient support for GOMP_SIMD_LANE
Date: Thu, 17 Sep 2015 12:36:00 -0000	[thread overview]
Message-ID: <bug-66142-4-VDVfSllXs8@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-66142-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66142

--- Comment #21 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ok, so if we fix SCCVN further we hit its (designed) limitation with stmt
walking not following backedges (but the use is in a loop and the def outside).
We avoid doing the work to determine if sth is loop invariant here.
This was trying to improve things with SRA disabled - I'm going to still push
those changes if testing works out fine.

Now with SRA enabled we have a better situation in this regard but face

  _9 = &D.4309[_12].org;
  MEM[(struct vec_ *)_9] = 1.0e+0;
  MEM[(struct vec_ *)_9 + 4B] = _8;
  D.4309[_12].dir.x = x_13;
  D.4309[_12].dir.y = y_14;
  D.4308[_12].t = 1.0e+10;
  D.4308[_12].h = 0;
  _20 = &D.4308[_12];
  _26 = MEM[(const struct Ray *)&D.4309][_12].org.x;

which as said isn't friendly enough for the simplistic address forward
propagation we have.  The issue here is that we can't disambiguate
against

  MEM[(struct vec_ *)_9 + 4B] = _8;

when looking up MEM[(const struct Ray *)&D.4309][_12].org.x; because
vn_reference_maybe_forwprop_address doesn't forward into MEM[(struct vec_ *)_9
+ 4B] as its offset is not zero:

      /* If that didn't work because the address isn't invariant propagate
         the reference tree from the address operation in case the current
         dereference isn't offsetted.  */
      if (!addr_base
          && *i_p == ops->length () - 1
          && off == 0
          /* This makes us disable this transform for PRE where the
             reference ops might be also used for code insertion which
             is invalid.  */
          && default_vn_walk_kind == VN_WALKREWRITE)
        {
          auto_vec<vn_reference_op_s, 32> tem;
          copy_reference_ops_from_ref (TREE_OPERAND (addr, 0), &tem);
          ops->pop ();
          ops->pop ();
          ops->safe_splice (tem);
          --*i_p;
          return true;

it also likely wouldn't help vn_reference_lookup_3 to do the disambiguation
as that performs just

      lhs_ops = valueize_refs_1 (lhs_ops, &valueized_anything);
      if (valueized_anything)
        {
          lhs_ref_ok = ao_ref_init_from_vn_reference (&lhs_ref,
                                                      get_alias_set (lhs),
                                                      TREE_TYPE (lhs),
lhs_ops);
          if (lhs_ref_ok
              && !refs_may_alias_p_1 (ref, &lhs_ref, true))
            return NULL;

but there is still the variable offset to cope with.  We'd need to perform
some disambiguation on lhs_ref vs. vr.

But it's not clear how to represent &D.4309[_12].org forwarded into
MEM[(struct vec_ *)_9 + 4B].  It's kind-of a COMPONENT_REF with just
a offset added.

Let's collect the improvements I have sofar in my local tree and see if they
otherwise work.


  parent reply	other threads:[~2015-09-17 12:36 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14 14:18 [Bug tree-optimization/66142] New: " ysrumyan at gmail dot com
2015-05-14 14:19 ` [Bug tree-optimization/66142] " ysrumyan at gmail dot com
2015-05-22 10:09 ` jakub at gcc dot gnu.org
2015-05-22 11:12 ` jakub at gcc dot gnu.org
2015-05-22 11:40 ` jakub at gcc dot gnu.org
2015-05-22 11:54 ` jakub at gcc dot gnu.org
2015-05-22 14:51 ` jakub at gcc dot gnu.org
2015-05-25  9:35 ` jakub at gcc dot gnu.org
2015-05-25 12:48 ` jakub at gcc dot gnu.org
2015-05-26  8:28 ` rguenther at suse dot de
2015-05-26  8:42 ` rguenth at gcc dot gnu.org
2015-05-26 13:56 ` rguenth at gcc dot gnu.org
2015-05-26 14:43 ` rguenth at gcc dot gnu.org
2015-05-27  7:56 ` rguenth at gcc dot gnu.org
2015-05-28 13:25 ` rguenth at gcc dot gnu.org
2015-05-29 13:07 ` jakub at gcc dot gnu.org
2015-06-02 13:18 ` rguenth at gcc dot gnu.org
2015-06-02 13:34 ` rguenth at gcc dot gnu.org
2015-06-03  8:03 ` rguenth at gcc dot gnu.org
2015-09-14 14:10 ` rguenth at gcc dot gnu.org
2015-09-17 12:36 ` rguenth at gcc dot gnu.org [this message]
2015-09-18  7:57 ` rguenth at gcc dot gnu.org
2021-05-04 13:17 ` 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-66142-4-VDVfSllXs8@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).