public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/66652] try_transform_to_exit_first_loop_alt generates incorrect loop
Date: Sat, 27 Jun 2015 05:52:00 -0000	[thread overview]
Message-ID: <bug-66652-4-o22FmJmUZc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-66652-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from vries at gcc dot gnu.org ---
Created attachment 35865
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35865&action=edit
follow-up patch for demonstrator patch

This patch in addition allows transform_to_exit_first_loop_alt for unsigned
loop counters. But it's not generic enough to also handle the fortran testcases
in https://gcc.gnu.org/ml/gcc-patches/2015-06/msg01234.html .

For parloops-exit-first-loop-alt.f95, we have:
...
foo (integer(kind=4)D.8 & restrict nrD.3381)
{
  integer(kind=4) ii;
  integer(kind=4) _6;
  integer(kind=4) _7;
  integer(kind=8) _8;
  integer(kind=4) _9;
  integer(kind=4) _10;
  integer(kind=4) _11;
  integer(kind=4) _12;
  integer(kind=4) _13;
  integer(kind=8) _16;
  unsigned int _19;
  integer(kind=4) _20;
  integer(kind=4) _22;
  integer(kind=4) _23;
  integer(kind=4) _24;
  signed int ivtmp_27;
  signed int ivtmp_28;

  <bb 2>:
  _6 = *nr_5(D);
  _7 = _6 + -1;
  if (_7 >= 0)
    goto <bb 4>;
  else
    goto <bb 3>;

  <bb 3>:
  return;

  <bb 4>:
  _20 = _6 + -1;
  _19 = (unsigned int) _20;

  <bb 10>:
  if (_19 > 199)
    goto <bb 11>;
  else
    goto <bb 12>;

  <bb 11>:

  <bb 5>:
  # ivtmp_27 = PHI <0(11), ivtmp_28(7)>
  ii_1 = ivtmp_27;
  _8 = (integer(kind=8)) ii_1;
  _9 = __BLNK__.a[_8];
  _11 = __BLNK__.b[_8];
  _12 = _9 + _11;
  _13 = _12 + 25;
  __BLNK__.c[_8] = _13;
  ii_15 = ii_1 + 1;
  if (ivtmp_27 < _19)
    goto <bb 7>;
  else
    goto <bb 6>;

  <bb 6>:
  goto <bb 3>;

  <bb 7>:
  ivtmp_28 = ivtmp_27 + 1;
  goto <bb 5>;

  <bb 12>:

  <bb 8>:
  # ii_18 = PHI <0(12), ii_26(9)>
  _16 = (integer(kind=8)) ii_18;
  _10 = __BLNK__.a[_16];
  _23 = __BLNK__.b[_16];
  _22 = _10 + _23;
  _24 = _22 + 25;
  __BLNK__.c[_16] = _24;
  ii_26 = ii_18 + 1;
  if (ii_18 == _7)
    goto <bb 6>;
  else
    goto <bb 9>;

  <bb 9>:
  goto <bb 8>;

}
...

the nit is _19:
...
  _20 = _6 + -1;
  _19 = (unsigned int) _20;
...


  parent reply	other threads:[~2015-06-27  5:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-66652-4@http.gcc.gnu.org/bugzilla/>
2015-06-25 12:37 ` vries at gcc dot gnu.org
2015-06-27  5:52 ` vries at gcc dot gnu.org [this message]
2015-06-29 11:41 ` vries at gcc dot gnu.org
2015-06-29 14:41 ` vries at gcc dot gnu.org
2015-06-30  8:36 ` vries at gcc dot gnu.org
2015-06-30  8:39 ` vries at gcc dot gnu.org
2015-06-30  9:58 ` vries 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-66652-4-o22FmJmUZc@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).