public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114972] New: [11/12/13/14/15 Regression] Missed optimization for Dead Code Elimination
@ 2024-05-07 11:40 652023330028 at smail dot nju.edu.cn
2024-05-07 12:31 ` [Bug tree-optimization/114972] " rguenth at gcc dot gnu.org
2024-05-07 23:11 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: 652023330028 at smail dot nju.edu.cn @ 2024-05-07 11:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114972
Bug ID: 114972
Summary: [11/12/13/14/15 Regression] Missed optimization for
Dead Code Elimination
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: 652023330028 at smail dot nju.edu.cn
Target Milestone: ---
Hello, we noticed that the code below can be optimized by Dead Code
Elimination, but gcc -O3 missed it.
This is a regression from GCC-6.1.
https://godbolt.org/z/fGzMeba66
int a, b, m;
void func() {
m = a + b;
a++;
b--;
if(a+b-m != 0) m=100; //dead code
}
GCC -O3:
func():
mov eax, DWORD PTR a[rip]
mov edx, DWORD PTR b[rip]
lea ecx, [rax+rdx]
add eax, 1
sub edx, 1
mov DWORD PTR a[rip], eax
add eax, edx
cmp ecx, eax
mov eax, 100
mov DWORD PTR b[rip], edx
cmovne ecx, eax
mov DWORD PTR m[rip], ecx
ret
Expected code (GCC-5.5)
func():
mov edx, DWORD PTR a[rip]
mov eax, DWORD PTR b[rip]
lea ecx, [rdx+rax]
add edx, 1
sub eax, 1
mov DWORD PTR a[rip], edx
mov DWORD PTR b[rip], eax
mov DWORD PTR m[rip], ecx
ret
Thank you very much for your time and effort! We look forward to hearing from
you.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/114972] [11/12/13/14/15 Regression] Missed optimization for Dead Code Elimination
2024-05-07 11:40 [Bug tree-optimization/114972] New: [11/12/13/14/15 Regression] Missed optimization for Dead Code Elimination 652023330028 at smail dot nju.edu.cn
@ 2024-05-07 12:31 ` rguenth at gcc dot gnu.org
2024-05-07 23:11 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-07 12:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114972
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.5
Keywords| |missed-optimization
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/114972] [11/12/13/14/15 Regression] Missed optimization for Dead Code Elimination
2024-05-07 11:40 [Bug tree-optimization/114972] New: [11/12/13/14/15 Regression] Missed optimization for Dead Code Elimination 652023330028 at smail dot nju.edu.cn
2024-05-07 12:31 ` [Bug tree-optimization/114972] " rguenth at gcc dot gnu.org
@ 2024-05-07 23:11 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-07 23:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114972
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2024-05-07
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
FRE was able to do:
RHS a.0_13 + b.1_14 simplified to a.0_3 + b.1_4 has constants 0
But then in GCC 6 it can't see that it is that.
Maybe when something moved over to match and simplify it is missed ...
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-07 23:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-07 11:40 [Bug tree-optimization/114972] New: [11/12/13/14/15 Regression] Missed optimization for Dead Code Elimination 652023330028 at smail dot nju.edu.cn
2024-05-07 12:31 ` [Bug tree-optimization/114972] " rguenth at gcc dot gnu.org
2024-05-07 23:11 ` 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).