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

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

[604] % 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) 
[605] % 
[605] % gcctk -O2 -S -o O2.s small.c
[606] % gcctk -O3 -S -o O3.s small.c
[607] % 
[607] % wc O2.s O3.s
  68  147  999 O2.s
  95  202 1373 O3.s
 163  349 2372 total
[608] % 
[608] % grep foo O2.s
[609] % grep foo O3.s
        call    foo
[610] % 
[610] % cat small.c
extern void foo(void);
int a, b, d, f;
static unsigned c;
void e(int g, int *k) {
  int h, *i = &b, *j = &b;
  *i = g;
  c = &b == i;
  d = c >= (*j = b | *k) && b & (*i == 0);
  h = a ? 0 : d;
  if (h)
    foo();
}
int main() {
  while (f) {
    int l;
    e(1, &l);
  }
  return 0;
}
  • [Bug tree-optimization/100080]... zhendong.su at inf dot ethz.ch via Gcc-bugs

Reply via email to