public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/100145] New: missed optimization for dead code elimination at -O3 (vs. -O2)
@ 2021-04-19  9:24 zhendong.su at inf dot ethz.ch
  2021-04-20  8:26 ` [Bug ipa/100145] " rguenth at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2021-04-19  9:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100145
           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: ---

[639] % 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 20210419 (experimental) [master revision
b412ce8e961:756887f4cee:d64720a07f611c55e8c815c775a852d650a2e738] (GCC)
[640] %
[640] % gcctk -O2 -S -o O2.s small.c
[641] % gcctk -O3 -S -o O3.s small.c
[642] %
[642] % wc O2.s O3.s
  77  164 1080 O2.s
  88  187 1234 O3.s
 165  351 2314 total
[643] %
[643] % grep foo O2.s
[644] % grep foo O3.s
        call    foo
[645] %
[645] % cat small.c
int b, c, d, e;
void foo();
int a(int f, int p) { return (p && f) || (f && p < 0 && p + 1) ? 0 : f + p; }
static int g() {
  int *h = &c;
  *h = 0;
  if (b) {
    int *i = &e;
    while (1) {
      *h = a(0, i != 0);
      if (*h)
        return 0;
    }
  }
  return 0;
}
int main() {
  int *k = &c;
  g();
  d = 1;
  if (*k > 100)
    foo();
  return 0;
}

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

end of thread, other threads:[~2023-06-09 17:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-19  9:24 [Bug tree-optimization/100145] New: missed optimization for dead code elimination at -O3 (vs. -O2) zhendong.su at inf dot ethz.ch
2021-04-20  8:26 ` [Bug ipa/100145] " rguenth at gcc dot gnu.org
2021-04-20  8:50 ` [Bug gcov-profile/100145] " rguenth at gcc dot gnu.org
2021-05-20 13:57 ` rguenth at gcc dot gnu.org
2023-06-09 17:20 ` 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).