public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110450] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0
@ 2023-06-28 10:21 theodort at inf dot ethz.ch
2023-06-29 6:52 ` [Bug tree-optimization/110450] " rguenth at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: theodort at inf dot ethz.ch @ 2023-06-28 10:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110450
Bug ID: 110450
Summary: [14 Regression] Dead Code Elimination Regression at
-O2 since r14-261-g0ef3756adf0
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: theodort at inf dot ethz.ch
Target Milestone: ---
https://godbolt.org/z/KqcYxfevj
Given the following code:
void foo(void);
static int a = 1;
static int *b = &a, *c = &a;
static short d, e;
static char f = 11;
static char(g)(char h, int i) { return h << i; }
int main() {
if (f) *c = g(0 >= a, 3);
e = *c;
d = e % f;
if (d) {
__builtin_unreachable();
} else if (*b)
foo();
;
}
gcc-trunk -O2 does not eliminate the call to foo:
main:
movl a(%rip), %eax
xorl %edx, %edx
testl %eax, %eax
setle %dl
leal 0(,%rdx,8), %edx
movl %edx, a(%rip)
jle .L8
xorl %eax, %eax
ret
.L8:
pushq %rax
call foo
xorl %eax, %eax
popq %rdx
ret
gcc-13.1.0 -O2 eliminates the call to foo:
main:
movl a(%rip), %edx
xorl %eax, %eax
testl %edx, %edx
setle %al
leal 0(,%rax,8), %eax
movl %eax, a(%rip)
xorl %eax, %eax
ret
Bisects to r14-261-g0ef3756adf0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/110450] [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0
2023-06-28 10:21 [Bug tree-optimization/110450] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0 theodort at inf dot ethz.ch
@ 2023-06-29 6:52 ` rguenth at gcc dot gnu.org
2023-07-01 20:51 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-29 6:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110450
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Target Milestone|--- |14.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/110450] [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0
2023-06-28 10:21 [Bug tree-optimization/110450] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0 theodort at inf dot ethz.ch
2023-06-29 6:52 ` [Bug tree-optimization/110450] " rguenth at gcc dot gnu.org
@ 2023-07-01 20:51 ` pinskia at gcc dot gnu.org
2023-11-24 4:01 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-01 20:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110450
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2023-07-01
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
In VRP:
trunk:
```
Folding statement: _11 = _9 % 11;
Matching expression match.pd:2480, gimple-match-4.cc:35
Matching expression match.pd:2483, gimple-match-3.cc:66
Matching expression match.pd:2490, gimple-match-2.cc:58
Matching expression match.pd:1991, gimple-match-5.cc:23
Matching expression match.pd:2480, gimple-match-4.cc:35
Matching expression match.pd:2483, gimple-match-3.cc:66
Matching expression match.pd:2490, gimple-match-2.cc:58
Matching expression match.pd:1948, gimple-match-7.cc:20
Matching expression match.pd:2480, gimple-match-4.cc:35
Matching expression match.pd:2483, gimple-match-3.cc:66
Matching expression match.pd:2490, gimple-match-2.cc:58
Applying pattern match.pd:5319, gimple-match-8.cc:2688
Applying pattern match.pd:6000, gimple-match-10.cc:587
Applying pattern match.pd:2102, gimple-match-1.cc:6289
Applying pattern match.pd:6000, gimple-match-10.cc:587
Applying pattern match.pd:5284, gimple-match-4.cc:1099
Applying pattern match.pd:1378, gimple-match-3.cc:7680
Applying pattern match.pd:4720, gimple-match-1.cc:16033
gimple_simplified to _14 = a.1_2 <= 0;
_15 = (int) _14;
_11 = _15 << 3;
Global Exported: _11 = [irange] int [0, 0][8, 8] NONZERO 0x8
Folded into: _11 = _15 << 3;
```
And the relationship between _5 and _11 is completely lost.
while in GCC 13:
```
Folding statement: _11 = _9 % 11;
Global Exported: _11 = [irange] int [0, 0][8, 8] NONZERO 0x8
Folded into: _11 = _9;
```
And then we remove the __builtin_unreachable even though we infer that _5 would
be 0 and therefore _11 would never be 8 .
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/110450] [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0
2023-06-28 10:21 [Bug tree-optimization/110450] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0 theodort at inf dot ethz.ch
2023-06-29 6:52 ` [Bug tree-optimization/110450] " rguenth at gcc dot gnu.org
2023-07-01 20:51 ` pinskia at gcc dot gnu.org
@ 2023-11-24 4:01 ` pinskia at gcc dot gnu.org
2024-01-10 15:13 ` jamborm at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-24 4:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110450
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |needs-bisection
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks to be fixed on the trunk.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/110450] [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0
2023-06-28 10:21 [Bug tree-optimization/110450] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0 theodort at inf dot ethz.ch
` (2 preceding siblings ...)
2023-11-24 4:01 ` pinskia at gcc dot gnu.org
@ 2024-01-10 15:13 ` jamborm at gcc dot gnu.org
2024-01-11 0:56 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jamborm at gcc dot gnu.org @ 2024-01-10 15:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110450
Martin Jambor <jamborm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|needs-bisection |
CC| |jamborm at gcc dot gnu.org
--- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> ---
This has been fixed with r14-4141-gbf6b107e2a3423 (Andrew MacLeod: New early
__builtin_unreachable processing).
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/110450] [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0
2023-06-28 10:21 [Bug tree-optimization/110450] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0 theodort at inf dot ethz.ch
` (3 preceding siblings ...)
2024-01-10 15:13 ` jamborm at gcc dot gnu.org
@ 2024-01-11 0:56 ` pinskia at gcc dot gnu.org
2024-01-13 4:39 ` cvs-commit at gcc dot gnu.org
2024-01-13 4:40 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-11 0:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110450
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Will commit the testcase and close it as fixed. The fix seems like the correct
one based on my comment:
> And then we remove the __builtin_unreachable even though we infer that _5 would be 0 and therefore _11 would never be 8 .
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/110450] [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0
2023-06-28 10:21 [Bug tree-optimization/110450] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0 theodort at inf dot ethz.ch
` (4 preceding siblings ...)
2024-01-11 0:56 ` pinskia at gcc dot gnu.org
@ 2024-01-13 4:39 ` cvs-commit at gcc dot gnu.org
2024-01-13 4:40 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-13 4:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110450
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:34a827039fabcf24ce78da25984a1cc8be7ca2c3
commit r14-7221-g34a827039fabcf24ce78da25984a1cc8be7ca2c3
Author: Andrew Pinski <quic_apinski@quicinc.com>
Date: Fri Jan 12 20:24:34 2024 -0800
Add a few testcases for fix missed optimization regressions
Adds a few new testcases for some missed optimization regressions.
The analysis on how each should be optimized is in the testcases
themselves (and in the bug report).
Committed as obvious after running the testsuite to make sure they pass.
PR tree-optimization/107823
PR tree-optimization/110768
PR tree-optimization/110941
PR tree-optimization/110450
PR tree-optimization/110841
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/ssa-thread-22.c: New test.
* gcc.dg/tree-ssa/vrp-loop-1.c: New test.
* gcc.dg/tree-ssa/vrp-loop-2.c: New test.
* gcc.dg/tree-ssa/vrp-unreachable-1.c: New test.
* gcc.dg/tree-ssa/vrp-unreachable-2.c: New test.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/110450] [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0
2023-06-28 10:21 [Bug tree-optimization/110450] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0 theodort at inf dot ethz.ch
` (5 preceding siblings ...)
2024-01-13 4:39 ` cvs-commit at gcc dot gnu.org
@ 2024-01-13 4:40 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-13 4:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110450
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-01-13 4:40 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-28 10:21 [Bug tree-optimization/110450] New: [14 Regression] Dead Code Elimination Regression at -O2 since r14-261-g0ef3756adf0 theodort at inf dot ethz.ch
2023-06-29 6:52 ` [Bug tree-optimization/110450] " rguenth at gcc dot gnu.org
2023-07-01 20:51 ` pinskia at gcc dot gnu.org
2023-11-24 4:01 ` pinskia at gcc dot gnu.org
2024-01-10 15:13 ` jamborm at gcc dot gnu.org
2024-01-11 0:56 ` pinskia at gcc dot gnu.org
2024-01-13 4:39 ` cvs-commit at gcc dot gnu.org
2024-01-13 4:40 ` 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).