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/106073] [12/13 Regression] wrong code at -O3 on x86_64-linux-gnu since r12-3903-g0288527f47cec669
Date: Fri, 29 Jul 2022 12:08:53 +0000	[thread overview]
Message-ID: <bug-106073-4-JLg7UIjML4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106073-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=90348

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Options reduced to

-O2 -funroll-loops -fno-tree-vectorize -fdisable-tree-cunrolli
-fdbg-cnt=gimple_unroll:3-6:8-8

in particular reducing late unrolling more will no longer reproduce the issue.
Disabling all threading after cunroll still reproduces the issue, thus
adding

-fdisable-tree-thread2 -fdisable-tree-threadfull2 -fdisable-tree-vrp2
-fdisable-tree-dom3

disabling IVOPTs hides the issue.  Making all functions but main static also
still reproduces the issue (so there's just one function left for late opts).
With that simplification

-O2 -funroll-loops -fno-tree-vectorize -fdisable-tree-cunrolli
-fdbg-cnt=gimple_unroll:3-6:8-8 -fdisable-tree-thread2
-fdisable-tree-threadfull2 -fdisable-tree-dom3 -fno-tree-vrp -fdump-tree-all
-fdbg-cnt=ivopts_loop:13-13:15-15

reproduces it, less IVOPTs does not.

So one difference triggering the issue is (good vs bad in .optimized):

@@ -328,20 +326,21 @@

   <bb 19> [local count: 60532]:
   l = 0;
+  ivtmp.151_212 = (unsigned long) &bf;
+  _507 = ivtmp.151_212 + 56;

   <bb 20> [local count: 412224]:
-  # ai_lsm.108_510 = PHI <d.13_27(19), _516(21)>
-  # ivtmp_511 = PHI <8(19), ivtmp_512(21)>
-  ivtmp_512 = ivtmp_511 - 1;
-  if (ivtmp_512 != 0)
+  # ivtmp.151_254 = PHI <ivtmp.151_212(19), ivtmp.151_380(21)>
+  if (ivtmp.151_254 != _507)
     goto <bb 21>; [89.00%]
   else
     goto <bb 22>; [11.00%]

   <bb 21> [local count: 366880]:
-  bf[ai_lsm.108_510][0] = 5;
-  bf[ai_lsm.108_510][1] = 5;
-  _516 = ai_lsm.108_510 + 1;
+  _506 = (void *) ivtmp.151_254;
+  MEM[(int *)_506] = 5;
+  MEM[(int *)_506 + 4B] = 5;
+  ivtmp.151_380 = ivtmp.151_254 + 8;
   goto <bb 20>; [100.00%]

   <bb 22> [local count: 45347]:
@@ -353,8 +352,6 @@

   <bb 23> [local count: 40253]:
   bf ={v} {CLOBBER(eol)};
-  ivtmp.132_498 = (unsigned long) &bf;
-  _480 = ivtmp.132_498 + 56;
   goto <bb 25>; [100.00%]

   <bb 24> [local count: 325681]:
@@ -364,8 +361,8 @@
   ivtmp.132_245 = ivtmp.132_383 + 8;

   <bb 25> [local count: 365933]:
-  # ivtmp.132_383 = PHI <ivtmp.132_498(23), ivtmp.132_245(24)>
-  if (ivtmp.132_383 != _480)
+  # ivtmp.132_383 = PHI <ivtmp.151_212(23), ivtmp.132_245(24)>
+  if (ivtmp.151_254 != ivtmp.132_383)
     goto <bb 24>; [89.00%]
   else
     goto <bb 26>; [11.00%]

that already causes quite some assembler changes :/

It's still not clear what goes wrong here.

Interestingly again, -fstack-reuse=none avoids the issue.  So maybe the
above hints at 'bf' being the issue here:

Partition 3: size 56 align 16
        av      au      bf
Partition 5: size 56 align 16
        av
Partition 1: size 44 align 16
        at
Partition 2: size 8 align 8
        au

  parent reply	other threads:[~2022-07-29 12:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24  8:06 [Bug tree-optimization/106073] New: wrong code at -O3 on x86_64-linux-gnu zhendong.su at inf dot ethz.ch
2022-06-24  8:06 ` [Bug tree-optimization/106073] " zhendong.su at inf dot ethz.ch
2022-06-24  8:28 ` [Bug tree-optimization/106073] [12/13 Regression] " pinskia at gcc dot gnu.org
2022-06-24 10:33 ` rguenth at gcc dot gnu.org
2022-06-27  8:57 ` [Bug tree-optimization/106073] [12/13 Regression] wrong code at -O3 on x86_64-linux-gnu since r12-3903-g0288527f47cec669 marxin at gcc dot gnu.org
2022-07-29 12:08 ` rguenth at gcc dot gnu.org [this message]
2023-05-08 12:24 ` [Bug tree-optimization/106073] [12/13/14 " 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-106073-4-JLg7UIjML4@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).