public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bmei at broadcom dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/59651] [4.9 Regression] Vectorizer failing to spot dependence causes incorrect code generation.
Date: Tue, 31 Dec 2013 22:42:00 -0000	[thread overview]
Message-ID: <bug-59651-4-nIiQ2osazj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-59651-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Bingfeng Mei <bmei at broadcom dot com> ---
I can reproduce on aarch64. Still try to understand why. I constructed a
similar test but with positive loop step.

extern void abort (void);
int a[] = { 6, 0, 0, 0 };

int b;
int
main ()
{
  for (;;)
    {
      b = 0;
      for (; b<3; b += 1)
    a[b] = a[0] > 1;
      break;
    }
  if (a[2] != 0)
    abort ();
  return 0;
}

Actually GCC behaves similarly during vectorization and does vectorize the
loop. The only difference is around loop versioning. 

pr52943.c
  <bb 10>:
  if (1 != 0)
    goto <bb 11>;
  else
    goto <bb 12>;

bb 11 leads to vectorized version. So scalar version gets optimized out.

Above example:
  <bb 10>:
  if (0 != 0)
    goto <bb 11>;
  else
    goto <bb 12>;
So vectorized version goes away and only scalar version remains.


  parent reply	other threads:[~2013-12-31 22:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-31 16:28 [Bug tree-optimization/59651] New: " belagod at gcc dot gnu.org
2013-12-31 16:53 ` [Bug tree-optimization/59651] " bmei at broadcom dot com
2013-12-31 17:12 ` belagod at gcc dot gnu.org
2013-12-31 21:07 ` [Bug tree-optimization/59651] [4.9 Regression] " pinskia at gcc dot gnu.org
2013-12-31 22:42 ` bmei at broadcom dot com [this message]
2014-01-01 18:31 ` belagod at gcc dot gnu.org
2014-01-02 11:04 ` bmei at broadcom dot com
2014-01-02 11:37 ` belagod at gcc dot gnu.org
2014-01-03 10:53 ` belagod at gcc dot gnu.org
2014-01-03 15:41 ` meibf at gcc dot gnu.org
2014-01-04 12:04 ` jakub at gcc dot gnu.org
2014-01-21 14:16 ` mshawcroft 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-59651-4-nIiQ2osazj@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).