public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug ipa/99834] New: missed optimization for dead code elimination at -O3 (vs. -O2) @ 2021-03-30 17:20 zhendong.su at inf dot ethz.ch 2021-03-31 8:04 ` [Bug ipa/99834] " rguenth at gcc dot gnu.org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: zhendong.su at inf dot ethz.ch @ 2021-03-30 17:20 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99834 Bug ID: 99834 Summary: missed optimization for dead code elimination at -O3 (vs. -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: --- [590] % 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 20210330 (experimental) [master revision 8aac913adfc:ff4ebc2f17c:65374af219f9c5c594951a07e766fe70c1136a1f] (GCC) [591] % [591] % gcctk -O2 -S -o O2.s small.c [592] % gcctk -O3 -S -o O3.s small.c [593] % [593] % wc O2.s O3.s 43 90 704 O2.s 61 126 950 O3.s 104 216 1654 total [594] % [594] % grep foo O2.s [595] % grep foo O3.s call foo call foo [596] % [596] % cat small.c extern void foo(void); static int a, b, c; static int d() { for (a = 0; a < 1; a++) b = 1; for (; b; b--) for (; c; c--) ; return 0; } static void e() { if (d()) foo(); } int main() { e(); e(); return 0; } ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug ipa/99834] missed optimization for dead code elimination at -O3 (vs. -O2) 2021-03-30 17:20 [Bug ipa/99834] New: missed optimization for dead code elimination at -O3 (vs. -O2) zhendong.su at inf dot ethz.ch @ 2021-03-31 8:04 ` rguenth at gcc dot gnu.org 2021-03-31 13:49 ` zhendong.su at inf dot ethz.ch 2023-08-18 1:39 ` pinskia at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: rguenth at gcc dot gnu.org @ 2021-03-31 8:04 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99834 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2021-03-31 Version|unknown |11.0 CC| |hubicka at gcc dot gnu.org Keywords| |missed-optimization Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Similar to the other bug - when 'main' is named 'bar' then we optimize it OK at -O3, the difference being again loop header copying not applied in "cold" context but inlining is. Not sure if we want to call this a bug, but then the inconsistency is odd. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug ipa/99834] missed optimization for dead code elimination at -O3 (vs. -O2) 2021-03-30 17:20 [Bug ipa/99834] New: missed optimization for dead code elimination at -O3 (vs. -O2) zhendong.su at inf dot ethz.ch 2021-03-31 8:04 ` [Bug ipa/99834] " rguenth at gcc dot gnu.org @ 2021-03-31 13:49 ` zhendong.su at inf dot ethz.ch 2023-08-18 1:39 ` pinskia at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: zhendong.su at inf dot ethz.ch @ 2021-03-31 13:49 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99834 --- Comment #2 from Zhendong Su <zhendong.su at inf dot ethz.ch> --- Hi Richard and all, thanks for analyzing these reports! I have some more cases, and wonder whether you folks would prefer that I open a meta issue report and append these (and others that we find) to that report (rather than filing these one by one). Thanks. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug ipa/99834] missed optimization for dead code elimination at -O3 (vs. -O2) 2021-03-30 17:20 [Bug ipa/99834] New: missed optimization for dead code elimination at -O3 (vs. -O2) zhendong.su at inf dot ethz.ch 2021-03-31 8:04 ` [Bug ipa/99834] " rguenth at gcc dot gnu.org 2021-03-31 13:49 ` zhendong.su at inf dot ethz.ch @ 2023-08-18 1:39 ` pinskia at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-08-18 1:39 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99834 --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The other way of optimizing this is to see that the return value of d is 0 (even early on) and do a const prop of that ... IN a sense an IPA-CCP for return values rather than for argument passing. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-18 1:39 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-03-30 17:20 [Bug ipa/99834] New: missed optimization for dead code elimination at -O3 (vs. -O2) zhendong.su at inf dot ethz.ch 2021-03-31 8:04 ` [Bug ipa/99834] " rguenth at gcc dot gnu.org 2021-03-31 13:49 ` zhendong.su at inf dot ethz.ch 2023-08-18 1:39 ` 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).