public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/100113] New: missed optimization for dead code elimination at -O3 (vs. -O1)
@ 2021-04-16  7:28 zhendong.su at inf dot ethz.ch
  2021-04-20  8:11 ` [Bug tree-optimization/100113] " 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-16  7:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100113
           Summary: missed optimization for dead code elimination at -O3
                    (vs. -O1)
           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: ---

[584] % 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 20210416 (experimental) [master revision
89c863488bc:10ed13839be:76c7e7d6b003a17d183d0571bf9b34c691819d25] (GCC) 
[585] % 
[585] % gcctk -O1 -S -o O1.s small.c
[586] % gcctk -O3 -S -o O3.s small.c
[587] % 
[587] % wc O1.s O3.s
  84  185 1140 O1.s
 120  254 1768 O3.s
 204  439 2908 total
[588] % 
[588] % grep foo O1.s
[589] % grep foo O3.s
        call    foo
[590] % 
[590] % cat small.c
extern void foo(void);
int a, b, d, *c = &a, e, k;
static int f(int *h, int i, int **l) {
  for (b = 0; b < 1; b++) {
    int *f = &d;
    for (; d < 1; d++)
      f = c;
    if (f != &a)
      __builtin_abort();
    if (k)
      *c = 0;
  }
  *c = 0;
  return **l;
}
int main() {
  int *j = &b;
  if (!f(j, e, &j))
    foo();
  return 0;
}

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

* [Bug tree-optimization/100113] missed optimization for dead code elimination at -O3 (vs. -O1)
  2021-04-16  7:28 [Bug tree-optimization/100113] New: missed optimization for dead code elimination at -O3 (vs. -O1) zhendong.su at inf dot ethz.ch
@ 2021-04-20  8:11 ` rguenth at gcc dot gnu.org
  2023-08-18  2:18 ` pinskia at gcc dot gnu.org
  2023-08-18  2:26 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-20  8:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-04-20
     Ever confirmed|0                           |1
            Version|unknown                     |11.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
dom3 manages to optimize it with -O1 but it gets different input with -O3.

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

* [Bug tree-optimization/100113] missed optimization for dead code elimination at -O3 (vs. -O1)
  2021-04-16  7:28 [Bug tree-optimization/100113] New: missed optimization for dead code elimination at -O3 (vs. -O1) zhendong.su at inf dot ethz.ch
  2021-04-20  8:11 ` [Bug tree-optimization/100113] " rguenth at gcc dot gnu.org
@ 2023-08-18  2:18 ` pinskia at gcc dot gnu.org
  2023-08-18  2:26 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-18  2:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection
      Known to fail|                            |12.2.0
      Known to work|                            |12.3.0, 13.1.0

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks to be fixed in GCC 12.3.0 and GCC 13.1.0 .

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

* [Bug tree-optimization/100113] missed optimization for dead code elimination at -O3 (vs. -O1)
  2021-04-16  7:28 [Bug tree-optimization/100113] New: missed optimization for dead code elimination at -O3 (vs. -O1) zhendong.su at inf dot ethz.ch
  2021-04-20  8:11 ` [Bug tree-optimization/100113] " rguenth at gcc dot gnu.org
  2023-08-18  2:18 ` pinskia at gcc dot gnu.org
@ 2023-08-18  2:26 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-18  2:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> Looks to be fixed in GCC 12.3.0 and GCC 13.1.0 .

A change in PRE which causes the IR to be different and allowed to be optimized
away in DOM3

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16  7:28 [Bug tree-optimization/100113] New: missed optimization for dead code elimination at -O3 (vs. -O1) zhendong.su at inf dot ethz.ch
2021-04-20  8:11 ` [Bug tree-optimization/100113] " rguenth at gcc dot gnu.org
2023-08-18  2:18 ` pinskia at gcc dot gnu.org
2023-08-18  2:26 ` 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).