public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110502] New: [14 Regression] Dead Code Elimination Regression at -Os since r14-1656-g55fcaa9a8bd
@ 2023-06-30 16:27 theodort at inf dot ethz.ch
2023-06-30 20:30 ` [Bug tree-optimization/110502] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: theodort at inf dot ethz.ch @ 2023-06-30 16:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110502
Bug ID: 110502
Summary: [14 Regression] Dead Code Elimination Regression at
-Os since r14-1656-g55fcaa9a8bd
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/T9rv1nsGr
Given the following code:
void foo(void);
static char e = -3L, k;
static int f;
static int *g;
static signed char *h = &e;
static signed char **i = &h;
static unsigned j;
static char(a)(char b, char c) { return b + c; }
static int(d)(int b, int c) { return b && b < -c ? b : b + c; }
static char l(char *n, unsigned short o) {
char p;
int q, s = 4104765887;
int *r = &f;
if (!(((o) >= 65533) && ((o) <= 65533))) {
__builtin_unreachable();
}
for (; s <= 4; s = a(s, 5)) {
int **t = &g;
*t = &s;
j++;
p = *n;
q = d(*g, p);
*r = q;
}
if (g || f)
;
else
foo();
return 0;
}
int main() {
l(&e, e);
char m = &k == (*i = &m);
}
gcc-trunk -Os does not eliminate the call to foo:
main:
pushq %rbx
movl $-190201409, %edx
xorl %esi, %esi
subq $16, %rsp
movl j(%rip), %ecx
movl $-190201409, 12(%rsp)
leal 15(%rcx), %r8d
.L2:
leal 1(%rcx), %edi
cmpl %r8d, %edi
je .L8
testl %edx, %edx
movb $1, %sil
sete %al
cmpl $2, %edx
setg %cl
orl %ecx, %eax
movl %edi, %ecx
movzbl %al, %eax
negl %eax
andl $-3, %eax
addl %edx, %eax
addl $5, %edx
movsbl %dl, %edx
jmp .L2
.L8:
testb %sil, %sil
leaq 12(%rsp), %rbx
je .L4
movq %rbx, g(%rip)
movl %ecx, j(%rip)
movl %eax, f(%rip)
jmp .L5
.L4:
cmpq $0, g(%rip)
jne .L5
cmpl $0, f(%rip)
jne .L5
call foo
.L5:
movq %rbx, h(%rip)
addq $16, %rsp
xorl %eax, %eax
popq %rbx
ret
gcc-13.1.0 -Os eliminates the call to foo:
main:
movl j(%rip), %edx
movl $-190201409, %eax
leal 14(%rdx), %esi
.L4:
testl %eax, %eax
je .L6
movl %eax, %ecx
cmpl $2, %eax
jle .L2
.L6:
leal -3(%rax), %ecx
.L2:
addl $5, %eax
incl %edx
movsbl %al, %eax
cmpl %esi, %edx
jne .L4
leaq -4(%rsp), %rax
movl %ecx, f(%rip)
movq %rax, g(%rip)
movq %rax, h(%rip)
xorl %eax, %eax
movl %edx, j(%rip)
ret
Bisects to r14-1656-g55fcaa9a8bd
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/110502] [14 Regression] Dead Code Elimination Regression at -Os since r14-1656-g55fcaa9a8bd
2023-06-30 16:27 [Bug tree-optimization/110502] New: [14 Regression] Dead Code Elimination Regression at -Os since r14-1656-g55fcaa9a8bd theodort at inf dot ethz.ch
@ 2023-06-30 20:30 ` pinskia at gcc dot gnu.org
2023-06-30 20:35 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-30 20:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110502
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Target Milestone|--- |14.0
Target| |x86_64-linux-gnu
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note on aarch64, it is still optimized (not you need -fsigned-char there or
change all char to be `signed char`).
Note also with -fno-ivopts, even GCC 13 is not optimizing out the call to foo.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/110502] [14 Regression] Dead Code Elimination Regression at -Os since r14-1656-g55fcaa9a8bd
2023-06-30 16:27 [Bug tree-optimization/110502] New: [14 Regression] Dead Code Elimination Regression at -Os since r14-1656-g55fcaa9a8bd theodort at inf dot ethz.ch
2023-06-30 20:30 ` [Bug tree-optimization/110502] " pinskia at gcc dot gnu.org
@ 2023-06-30 20:35 ` pinskia at gcc dot gnu.org
2023-09-16 6:21 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-30 20:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110502
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-06-30
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/110502] [14 Regression] Dead Code Elimination Regression at -Os since r14-1656-g55fcaa9a8bd
2023-06-30 16:27 [Bug tree-optimization/110502] New: [14 Regression] Dead Code Elimination Regression at -Os since r14-1656-g55fcaa9a8bd theodort at inf dot ethz.ch
2023-06-30 20:30 ` [Bug tree-optimization/110502] " pinskia at gcc dot gnu.org
2023-06-30 20:35 ` pinskia at gcc dot gnu.org
@ 2023-09-16 6:21 ` pinskia at gcc dot gnu.org
2024-03-08 15:29 ` law at gcc dot gnu.org
2024-05-07 7:41 ` [Bug tree-optimization/110502] [14/15 " rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-16 6:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110502
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note LIM2 has way different IR selection which is kinda interesting since there
are no stores that happened in the bbs that were removed:
if (_2 != 0)
goto <bb 4>; [75.00%]
else
goto <bb 5>; [25.00%]
<bb 4> [local count: 6515660663]:
iftmp.8_23 = s.5_14 + -3;
<bb 5> [local count: 8687547565]:
# iftmp.8_24 = PHI <s.5_14(3), iftmp.8_23(4)>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/110502] [14 Regression] Dead Code Elimination Regression at -Os since r14-1656-g55fcaa9a8bd
2023-06-30 16:27 [Bug tree-optimization/110502] New: [14 Regression] Dead Code Elimination Regression at -Os since r14-1656-g55fcaa9a8bd theodort at inf dot ethz.ch
` (2 preceding siblings ...)
2023-09-16 6:21 ` pinskia at gcc dot gnu.org
@ 2024-03-08 15:29 ` law at gcc dot gnu.org
2024-05-07 7:41 ` [Bug tree-optimization/110502] [14/15 " rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-08 15:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110502
Jeffrey A. Law <law at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |law at gcc dot gnu.org
Priority|P3 |P2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/110502] [14/15 Regression] Dead Code Elimination Regression at -Os since r14-1656-g55fcaa9a8bd
2023-06-30 16:27 [Bug tree-optimization/110502] New: [14 Regression] Dead Code Elimination Regression at -Os since r14-1656-g55fcaa9a8bd theodort at inf dot ethz.ch
` (3 preceding siblings ...)
2024-03-08 15:29 ` law at gcc dot gnu.org
@ 2024-05-07 7:41 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-07 7:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110502
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|14.0 |14.2
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 14.1 is being released, retargeting bugs to GCC 14.2.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-05-07 7:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-30 16:27 [Bug tree-optimization/110502] New: [14 Regression] Dead Code Elimination Regression at -Os since r14-1656-g55fcaa9a8bd theodort at inf dot ethz.ch
2023-06-30 20:30 ` [Bug tree-optimization/110502] " pinskia at gcc dot gnu.org
2023-06-30 20:35 ` pinskia at gcc dot gnu.org
2023-09-16 6:21 ` pinskia at gcc dot gnu.org
2024-03-08 15:29 ` law at gcc dot gnu.org
2024-05-07 7:41 ` [Bug tree-optimization/110502] [14/15 " rguenth 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).