https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100034
Bug ID: 100034 Summary: missed optimization for dead code elimination at -O3 (vs. -O1, -Os, -O2) Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: zhendong.su at inf dot ethz.ch CC: marxin at gcc dot gnu.org Target Milestone: --- [641] % 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) [642] % [642] % gcctk -O1 -S -o O1.s small.c [643] % gcctk -O3 -S -o O3.s small.c [644] % [644] % wc O1.s O3.s 23 45 420 O1.s 41 78 697 O3.s 64 123 1117 total [645] % [645] % grep foo O1.s [646] % grep foo O3.s call foo [647] % [647] % cat small.c extern void foo(void); static int a, b, f, g; static int d() { while (g) f = 0; while (1) foo(); } static void c() { d (); } void e() { while (b) { if (!a) continue; c(); } } int main() { e(); return 0; }