public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/100082] New: missed optimization for dead code elimination at -O3 (vs. -O2)
@ 2021-04-14 14:36 zhendong.su at inf dot ethz.ch
  2021-04-15  6:51 ` [Bug tree-optimization/100082] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2021-04-14 14:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100082
           Summary: missed optimization for dead code elimination at -O3
                    (vs. -O2)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

[528] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/11.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.1 20210414 (experimental) [master revision
006783f4b16:29da9c11552:0589be0c59767cf4cbb0ef0e7d918cf6aa3d606c] (GCC) 
[529] % 
[529] % gcctk -O2 -S -o O2.s small.c
[530] % gcctk -O3 -S -o O3.s small.c
[531] % 
[531] % wc O2.s O3.s
 101  229 1393 O2.s
 145  329 2038 O3.s
 246  558 3431 total
[532] % 
[532] % grep foo O2.s
[533] % grep foo O3.s
        call    foo
[534] % 
[534] % cat small.c
extern void foo(void);
volatile int a, b, h;
int *c, d[4], f, i, j;
long g;
static unsigned e() {
  int k;
  while (b) {
    for (k = 0; k < 4; k++) {
      d[k] && a;
      h = j ? 0 : i;
    }
    *c = 0;
  }
  return 0;
}
int main() {
  for (f = 0; f < 5; f++)
    g = 1;
  if (!e() ^ g)
    foo();
  return 0;
}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/100082] missed optimization for dead code elimination at -O3 (vs. -O2)
  2021-04-14 14:36 [Bug tree-optimization/100082] New: missed optimization for dead code elimination at -O3 (vs. -O2) zhendong.su at inf dot ethz.ch
@ 2021-04-15  6:51 ` rguenth at gcc dot gnu.org
  2023-05-05  7:53 ` pinskia at gcc dot gnu.org
  2023-08-18  3:54 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-15  6:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
           Keywords|                            |missed-optimization
            Version|unknown                     |11.0
   Last reconfirmed|                            |2021-04-15

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  At -O2 PRE manages to optimize the call to foo.  The difference
starts at cunrolli where -O3 unrolls but -O2 not, disabling cunrolli restores
optimization.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/100082] missed optimization for dead code elimination at -O3 (vs. -O2)
  2021-04-14 14:36 [Bug tree-optimization/100082] New: missed optimization for dead code elimination at -O3 (vs. -O2) zhendong.su at inf dot ethz.ch
  2021-04-15  6:51 ` [Bug tree-optimization/100082] " rguenth at gcc dot gnu.org
@ 2023-05-05  7:53 ` pinskia at gcc dot gnu.org
  2023-08-18  3:54 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-05  7:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |12.1.0
           Keywords|                            |needs-bisection

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Seems fixed in GCC 12

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/100082] missed optimization for dead code elimination at -O3 (vs. -O2)
  2021-04-14 14:36 [Bug tree-optimization/100082] New: missed optimization for dead code elimination at -O3 (vs. -O2) zhendong.su at inf dot ethz.ch
  2021-04-15  6:51 ` [Bug tree-optimization/100082] " rguenth at gcc dot gnu.org
  2023-05-05  7:53 ` pinskia at gcc dot gnu.org
@ 2023-08-18  3:54 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-18  3:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks like it is jump threading differences between GCC 11 and GCC 12 which
fixes this.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-18  3:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-14 14:36 [Bug tree-optimization/100082] New: missed optimization for dead code elimination at -O3 (vs. -O2) zhendong.su at inf dot ethz.ch
2021-04-15  6:51 ` [Bug tree-optimization/100082] " rguenth at gcc dot gnu.org
2023-05-05  7:53 ` pinskia at gcc dot gnu.org
2023-08-18  3:54 ` pinskia at gcc dot gnu.org

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).