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

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

[583] % 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 20210411 (experimental) [master revision
1d54b138417:e83b9cf4549:936d500dfc17f58f2507ecd0f7f26e4f197052ee] (GCC) 
[584] % 
[584] % gcctk -O2 -S -o O2.s small.c
[585] % gcctk -O3 -S -o O3.s small.c
[586] % 
[586] % wc O2.s O3.s
  52  112  797 O2.s
  56  119  850 O3.s
 108  231 1647 total
[587] % 
[587] % grep foo O2.s
[588] % grep foo O3.s
        call    foo
[589] % 
[589] % cat small.c
extern void foo(void);
static volatile int a;
int b, i;
static void c() {
  unsigned d = i;
  a = d && a;
  if (d) {
    int e;
    while (b) {
      int *f, *g = &e, **h = &f;
      *h = g;
      *f = d;
    }
    if (!e)
      foo();
  }
}
int main() {
  c();
  return 0;
}
  • [Bug tree-optimization/100033]... zhendong.su at inf dot ethz.ch via Gcc-bugs

Reply via email to