https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99986
Bug ID: 99986 Summary: missed optimization for dead code elimination at -O3 (vs. -O1) 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: --- [599] % 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 20210409 (experimental) [master revision 96292c3e343:4e14cad25b9:019a922063f26784d5a070d9198a1f937b8a8343] (GCC) [600] % [600] % gcctk -O1 -S -o O1.s small.c [601] % gcctk -O3 -S -o O3.s small.c [602] % [602] % wc O1.s O3.s 38 86 669 O1.s 48 107 845 O3.s 86 193 1514 total [603] % [603] % grep foo O1.s [604] % grep foo O3.s call foo [605] % [605] % cat small.c extern void foo(void); static int a, *b[8] = {&a}, **c[8]; static void d() { int e = 0; for (; e < 8; e++) c[e] = &b[1]; if (!c[0]) foo(); } int main() { if (a) d(); return 0; }