public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/100095] New: missed optimization for dead code elimination at -O3 (vs. -O2)
@ 2021-04-15 11:07 zhendong.su at inf dot ethz.ch
2021-04-15 12:06 ` [Bug tree-optimization/100095] " rguenth at gcc dot gnu.org
2023-08-09 21:57 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2021-04-15 11:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100095
Bug ID: 100095
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: ---
[654] % 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 20210415 (experimental) [master revision
4dd9e1c541e:7315804b0a0:b5f644a98b3f3543d3a8d2dfea7785c22879013f] (GCC)
[655] %
[655] % gcctk -O2 -S -c -o O2.s small.c
[656] % gcctk -O3 -S -c -o O3.s small.c
[657] %
[657] % wc O2.s O3.s
75 164 982 O2.s
121 269 1617 O3.s
196 433 2599 total
[658] %
[658] % grep foo O2.s
[659] % grep foo O3.s
jmp foo
[660] %
[660] % cat small.c
extern void foo(void);
int a, b, c, d, g, h;
static int *e = &d;
volatile int f;
void i() {
for (d = 5; d >= 0; d--)
for (c = 0; c < 4; c++)
while (1) {
h = b ? a % b : 0;
if (g)
f;
if (*e)
break;
}
foo();
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/100095] missed optimization for dead code elimination at -O3 (vs. -O2)
2021-04-15 11:07 [Bug tree-optimization/100095] New: missed optimization for dead code elimination at -O3 (vs. -O2) zhendong.su at inf dot ethz.ch
@ 2021-04-15 12:06 ` rguenth at gcc dot gnu.org
2023-08-09 21:57 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-15 12:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100095
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks| |85316
Version|unknown |11.0
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-04-15
Keywords| |missed-optimization
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
VRP optimizes this at -O2 but fails at -O3 where we fail to do some
final value replacement as we unswitch the loop nest on the b != 0 condition
which makes us end up with multiple exits which final_value_replacement_loop
doesn't like (it's somewhat artificial what we end up with - leaving
code commoning on the plate).
In the end the trigger of the missing optimization is unswitching.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85316
[Bug 85316] [meta-bug] VRP range propagation missed cases
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/100095] missed optimization for dead code elimination at -O3 (vs. -O2)
2021-04-15 11:07 [Bug tree-optimization/100095] New: missed optimization for dead code elimination at -O3 (vs. -O2) zhendong.su at inf dot ethz.ch
2021-04-15 12:06 ` [Bug tree-optimization/100095] " rguenth at gcc dot gnu.org
@ 2023-08-09 21:57 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-08-09 21:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100095
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |12.1.0
Keywords| |needs-bisection
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks to be fixed for GCC 12.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-09 21:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15 11:07 [Bug tree-optimization/100095] New: missed optimization for dead code elimination at -O3 (vs. -O2) zhendong.su at inf dot ethz.ch
2021-04-15 12:06 ` [Bug tree-optimization/100095] " rguenth at gcc dot gnu.org
2023-08-09 21:57 ` 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).