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/106155] [12/13 Regression] spurious "may be used uninitialized" warning
Date: Wed, 31 Aug 2022 14:04:11 +0000	[thread overview]
Message-ID: <bug-106155-4-tOtuwdKj0D@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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue here is that we see

<bb 3> [local count: 805306369]:
# emax_41 = PHI <emax_9(9), emax_22(D)(2)>
# ivtmp.7_44 = PHI <ivtmp.7_45(9), 0(2)>
i_46 = (int) ivtmp.7_44;
if (i_46 == 2)
  goto <bb 4>; [12.49%] // init
else
  goto <bb 10>; [87.51%]

...


<bb 7> [local count: 805306369]:
fh.1_6 = fh;
f4 (fh.1_6);
e.2_7 = e;
*e.2_7 = 0;
f1 ();
if (ivtmp.7_44 == 2)
  goto <bb 8>; [12.49%] // use
else
  goto <bb 9>; [87.51%]

and the predicates i_46 == 2 and ivtmp.7_44 == 2 do not match up.

Oh, and my r13-2149-g200baf7698a100 change made us run into

  if (dominated_by_p (CDI_POST_DOMINATORS, def_bb, use_bb))
    /* The use is not guarded.  */
    return false;

for this use on the loop exit because post-dominance doesn't cover
loop exit conditions.

I will think about this a bit more.

I'll also note it is a missed optimization to not replace the i_46 == 2
check.  -fno-ivopts makes the warning disappear (when the above is fixed).
For some reason we do not optimize the

  i_46 = (int) ivtmp.7_44;
  if (i_46 == 2)

stmt, likely because ivtmp is 64bit while i is 32bit and we don't check
ivtmps value range here.

  parent reply	other threads:[~2022-08-31 14:04 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
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 [this message]
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-tOtuwdKj0D@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).