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/106155] [12/13 Regression] spurious "may be used uninitialized" warning
Date: Fri, 01 Jul 2022 02:32:45 +0000	[thread overview]
Message-ID: <bug-106155-4-16xDPwqPxg@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106155-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-07-01
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |12.2
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---

init_from_control_deps {{0 -> 3}}:
        i_44 != 2 (expanded)
        NOT (i_44 == 2)
After normalization [DEF]:
        i_44 != 2 (expanded)
        NOT (i_44 == 2)
After normalization [USE]:
        f2 (emax_8);
  is conditional on:
        ivtmp.7_37 == 2 (expanded)
        ivtmp.7_37 == 2

Which is funny we get:

  # ivtmp.7_37 = PHI <ivtmp.7_38(9), 0(2)>
  i_44 = (int) ivtmp.7_37;
  if (i_44 == 2)
    goto <bb 4>; [12.49%]
  else
    goto <bb 10>; [87.51%]
....
  if (ivtmp.7_37 == 2)
    goto <bb 8>; [12.49%]
  else
    goto <bb 9>; [87.51%]

  <bb 8> [local count: 268435456]:
  f2 (emax_8);

I don't know why ivopts only changed the second if and not the first.

Oh because the second is the exit check:
Replacing exit test: if (ivtmp_39 != 0)
Replacing exit test: if (i_40 == 2)

If we change the size to 4 and keep the 2 as 2, there would be no warning.
And if then change 2 to 3, the warning is back.

So there is a missed optimization of changing the internal comparison for the
IV to the new type if the right side is a constant.

  parent reply	other threads:[~2022-07-01  2:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01  1:49 [Bug tree-optimization/106155] New: " vincent-gcc at vinc17 dot net
2022-07-01  2:05 ` [Bug tree-optimization/106155] " vincent-gcc at vinc17 dot net
2022-07-01  2:32 ` pinskia at gcc dot gnu.org [this message]
2022-07-01  2:43 ` pinskia at gcc dot gnu.org
2022-07-04 12:09 ` marxin at gcc dot gnu.org
2022-07-25 15:27 ` rguenth at gcc dot gnu.org
2022-08-31 14:04 ` rguenth at gcc dot gnu.org
2022-09-06 12:57 ` rguenth at gcc dot gnu.org
2022-09-06 13:17 ` rguenth at gcc dot gnu.org
2022-09-06 13:21 ` rguenth at gcc dot gnu.org
2022-10-17 12:30 ` rguenth at gcc dot gnu.org
2022-11-23 16:44 ` vincent-gcc at vinc17 dot net
2023-05-08 12:24 ` [Bug tree-optimization/106155] [12/13/14 " rguenth at gcc dot gnu.org
2023-06-13  2:03 ` vincent-gcc at vinc17 dot net

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-106155-4-16xDPwqPxg@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).