public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/103723] zero extend not moved out of the loop after IV-OPTS
Date: Wed, 15 Dec 2021 11:39:35 +0000	[thread overview]
Message-ID: <bug-103723-4-16E7iLnTi2@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103723-4@http.gcc.gnu.org/bugzilla/>

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-12-15
            Summary|Loop invariant motion pass  |zero extend not moved out
                   |failed to remove unused     |of the loop after IV-OPTS
                   |code from loop              |
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Severity|normal                      |enhancement

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>For this case, the instruction  `mov     ecx, eax` in bb `.L3` could remove from loop body and could sink to '.L8' and '.L1'.

Right the problem is not what you referenced in the comment #0 though, it is
the following instead:
  _4 = (unsigned int) ivtmp.7_15;

That is a truncate from 64bit to 32bit.
There is no pass after IV-OPTS that sinks the zero extend out of the loop
though. LIM on the gimple level is not doing it for some reason ...

At Lim4 we have:
  <bb 4> [local count: 1014686026]:
  # ivtmp.7_15 = PHI <ivtmp.7_7(7), 2(6)>
  _4 = (unsigned int) ivtmp.7_15;
  len_test_13 = _4;
  _3 = MEM[(const uint8_t *)buf_9(D) + ivtmp.7_15 * 1];
  _6 = MEM[(const uint8_t *)buf_back_11(D) + ivtmp.7_15 * 1];
  if (_3 == _6)
    goto <bb 3>; [94.50%]
  else
    goto <bb 10>; [5.50%]

  <bb 10> [local count: 55807731]:
  # len_test_16 = PHI <len_test_13(4)>

I don't know enough about LIM if it was designed to handle non stores to sink
but maybe it should.

  reply	other threads:[~2021-12-15 11:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-15  2:54 [Bug tree-optimization/103723] New: Loop invariant motion pass failed to remove unused code from loop lingling.kong7 at gmail dot com
2021-12-15 11:39 ` pinskia at gcc dot gnu.org [this message]
2021-12-15 11:45 ` [Bug tree-optimization/103723] zero extend not moved out of the loop after IV-OPTS pinskia at gcc dot gnu.org
2022-01-04 11:24 ` [Bug tree-optimization/103723] zero extend not sunk out of the loop after IV-OPTS in the sink pass 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-103723-4-16E7iLnTi2@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).