public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/95757] [11 regression] missing warning in gcc.dg/Wstringop-overflow-25.c since r11-1517
Date: Mon, 01 Mar 2021 14:48:21 +0000	[thread overview]
Message-ID: <bug-95757-4-OliqJqchxW@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95757-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aldyh at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
We get only 3 warnings on the last function with
-O2 -Wall -Wno-array-bounds --param=logical-op-non-short-circuit=0
-ftrack-macro-expansion=0
while we get 4 with
-O2 -Wall -Wno-array-bounds --param=logical-op-non-short-circuit=1
-ftrack-macro-expansion=0
I think the important differences are that while we have in *.optimized pretty
much the same IL - I only see differences between SSA_NAME versions, in the
--param=logical-op-non-short-circuit=1 case we have more accurate
SSA_NAME_RANGE_INFO on 3 SSA_NAMEs
   <bb 2> [local count: 1073741824]:
-  _51 ={v} unsigned_value_source;
-  if (_51 > 1)
+  _57 ={v} unsigned_value_source;
+  if (_57 > 1)
     goto <bb 4>; [50.00%]
   else
     goto <bb 3>; [50.00%]

   <bb 3> [local count: 536870912]:
   # RANGE [1, 2] NONZERO 3
-  _55 = _51 + 1;
+  _55 = _57 + 1;

   <bb 4> [local count: 1073741824]:
   # RANGE [1, 2] NONZERO 3
-  # prephitmp_54 = PHI <_55(3), 1(2)>
-  _49 ={v} unsigned_value_source;
-  _48 = _49 + 18446744073709551615;
-  if (_48 > 1)
+  # prephitmp_50 = PHI <1(2), _55(3)>
+  _52 ={v} unsigned_value_source;
+  _59 = _52 + 18446744073709551615;
+  if (_59 > 1)
     goto <bb 6>; [50.00%]
   else
     goto <bb 5>; [50.00%]

-  <bb 5> [local count: 268435457]:
-  _53 = _49 + 1;
+  <bb 5> [local count: 536870913]:
+  # RANGE [2, 3] NONZERO 3
+  _53 = _52 + 1;

   <bb 6> [local count: 1073741824]:
-  # prephitmp_57 = PHI <2(4), _53(5)>
+  # RANGE [2, 3] NONZERO 3
+  # prephitmp_54 = PHI <2(4), _53(5)>
   _47 ={v} unsigned_value_source;
-  _52 = _47 + 18446744073709551614;
-  if (_52 > 1)
+  _61 = _47 + 18446744073709551614;
+  if (_61 > 1)
     goto <bb 8>; [50.00%]
   else
     goto <bb 7>; [50.00%]

-  <bb 7> [local count: 268435457]:
-  _59 = _47 + 1;
+  <bb 7> [local count: 536870913]:
+  # RANGE [3, 4] NONZERO 7
+  _48 = _47 + 1;

   <bb 8> [local count: 1073741824]:
...
I mean the _53, prephitmp_54 and _48 ranges above in the + lines (i.e. =1).
Early during optimizations we have the usual short-circuit vs.
non-short-circuit differences like:
-  # iftmp.0_52 = PHI <_51(3), 0(2)>
-  _49 ={v} unsigned_value_source;
-  if (_49 == 0)
-    goto <bb 7>; [50.00%]
+  # iftmp.0_58 = PHI <0(2), _57(3)>
+  _52 ={v} unsigned_value_source;
+  _53 = _52 == 0;
+  _54 = _52 > 2;
+  _55 = _53 | _54;
+  if (_55 != 0)
+    goto <bb 6>; [50.00%]
   else
     goto <bb 5>; [50.00%]

   <bb 5> [local count: 536870913]:
-  if (_49 > 2)
-    goto <bb 7>; [50.00%]
-  else
-    goto <bb 6>; [50.00%]
-
-  <bb 6> [local count: 268435456]:

-  <bb 7> [local count: 1073741824]:
-  # iftmp.0_50 = PHI <1(4), 1(5), _49(6)>
+  <bb 6> [local count: 1073741824]:
+  # iftmp.0_56 = PHI <1(4), _52(5)>
but they gradually disappear.
Right before *.dom3 the IL is already pretty much the same when ignoring
SSA_NAME version differences,
except:
-  # prephitmp_54 = PHI <_55(3), 1(2)>
-  _49 ={v} unsigned_value_source;
-  _48 = _49 + 18446744073709551615;
-  _1 = _48 > 1;
-  if (_1 != 0)
+  # prephitmp_50 = PHI <1(2), _55(3)>
+  _52 ={v} unsigned_value_source;
+  _59 = _52 + 18446744073709551615;
+  if (_59 > 1)
and
   _47 ={v} unsigned_value_source;
-  _52 = _47 + 18446744073709551614;
-  _50 = _52 > 1;
-  if (_50 != 0)
+  _61 = _47 + 18446744073709551614;
+  if (_61 > 1)
i.e. the - version (=0) doesn't have the comparisons folded into GIMPLE_CONDs
while the + version (=1) does.
And I believe that is the trigger on why during dom3 adds the more precise
ranges in the --param=logical-op-non-short-circuit=1 case and not in the
--param=logical-op-non-short-circuit=0 case.

  parent reply	other threads:[~2021-03-01 14:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19  2:05 [Bug middle-end/95757] New: " seurer at linux dot vnet.ibm.com
2020-06-19  7:23 ` [Bug middle-end/95757] " rguenth at gcc dot gnu.org
2020-06-19  7:35 ` clyon at gcc dot gnu.org
2020-08-13 15:33 ` seurer at gcc dot gnu.org
2020-10-16 11:53 ` rguenth at gcc dot gnu.org
2020-10-16 12:03 ` clyon at gcc dot gnu.org
2020-12-16 18:14 ` seurer at gcc dot gnu.org
2021-02-23  2:59 ` hp at gcc dot gnu.org
2021-02-26 12:12 ` rguenth at gcc dot gnu.org
2021-03-01 14:48 ` jakub at gcc dot gnu.org [this message]
2021-03-01 17:59 ` jakub at gcc dot gnu.org
2021-03-02 10:49 ` cvs-commit at gcc dot gnu.org
2021-03-02 10:55 ` jakub 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-95757-4-OliqJqchxW@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).