public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110414] New: [14 Regression] Dead Code Elimination Regression since r14-1127-g9e2017ae6ac
@ 2023-06-26 15:06 theodort at inf dot ethz.ch
2023-06-27 6:33 ` [Bug tree-optimization/110414] " rguenth at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: theodort at inf dot ethz.ch @ 2023-06-26 15:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110414
Bug ID: 110414
Summary: [14 Regression] Dead Code Elimination Regression
since r14-1127-g9e2017ae6ac
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/5E795dPvY
Given the following code:
void foo(void);
static int a, b, e, l, m, n;
static int *c = &a, *j;
static int **d = &c;
static int ***f;
void __assert_fail(char *, char *, int, char *) __attribute__((__noreturn__));
static void g(char) {
if (c == &b || c == &a)
;
else
__assert_fail("", "", 3, __PRETTY_FUNCTION__);
}
static void h();
static int *i();
static short k() {
j = i();
h();
**f = &e;
if (c == &b || c == &a || c == 0)
__assert_fail("", "", 6, __PRETTY_FUNCTION__);
return 0;
}
static void h() {
if (l) {
for (; l; l = l - 8) *d = &m;
if (c == &a)
;
else
__assert_fail("", "", 9, __PRETTY_FUNCTION__);
}
if (c == &b || c == &a || c == 0)
;
else {
foo();
__assert_fail("", "", 8, __PRETTY_FUNCTION__);
}
}
static int *i() {
if (c == &b || c == &a)
;
else {
__builtin_unreachable();
__assert_fail("", "", 6, __PRETTY_FUNCTION__);
}
return &n;
}
int main() { g(a && k()); }
gcc-trunk -Os does not eliminate the call to foo:
main:
pushq %rcx
cmpl $0, a(%rip)
je .L2
movl l(%rip), %edx
testl %edx, %edx
je .L3
movl %edx, %eax
movl $__PRETTY_FUNCTION__.1, %ecx
movq $m, c(%rip)
shrl $3, %eax
imull $-8, %eax, %eax
addl %edx, %eax
movl $9, %edx
movl %eax, l(%rip)
jmp .L7
.L3:
movq c(%rip), %rax
cmpq $a, %rax
sete %dl
cmpq $b, %rax
sete %cl
orb %cl, %dl
jne .L4
testq %rax, %rax
je .L4
call foo
movl $__PRETTY_FUNCTION__.1, %ecx
movl $8, %edx
.L7:
movl $.LC0, %esi
movq %rsi, %rdi
call __assert_fail
.L4:
movl $__PRETTY_FUNCTION__.2, %ecx
movl $6, %edx
jmp .L7
.L2:
movq c(%rip), %rax
cmpq $a, %rax
je .L5
cmpq $b, %rax
je .L5
movl $__PRETTY_FUNCTION__.0, %ecx
movl $3, %edx
jmp .L7
.L5:
xorl %eax, %eax
popq %rdx
ret
gcc-13.1.0 -Os eliminates the call to foo:
main:
pushq %rcx
movq c(%rip), %rdx
cmpq $a, %rdx
sete %al
cmpq $b, %rdx
sete %dl
orl %edx, %eax
cmpl $0, a(%rip)
je .L2
movl l(%rip), %edx
testl %edx, %edx
je .L3
movl %edx, %eax
movl $__PRETTY_FUNCTION__.1, %ecx
movq $m, c(%rip)
shrl $3, %eax
imull $-8, %eax, %eax
addl %edx, %eax
movl $9, %edx
movl %eax, l(%rip)
jmp .L7
.L2:
testb %al, %al
jne .L5
movl $__PRETTY_FUNCTION__.0, %ecx
movl $3, %edx
.L7:
movl $.LC0, %esi
movq %rsi, %rdi
call __assert_fail
.L3:
movl $__PRETTY_FUNCTION__.2, %ecx
movl $6, %edx
jmp .L7
.L5:
xorl %eax, %eax
popq %rdx
ret
Bisects to r14-1127-g9e2017ae6ac
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/110414] [14 Regression] Dead Code Elimination Regression since r14-1127-g9e2017ae6ac
2023-06-26 15:06 [Bug tree-optimization/110414] New: [14 Regression] Dead Code Elimination Regression since r14-1127-g9e2017ae6ac theodort at inf dot ethz.ch
@ 2023-06-27 6:33 ` rguenth at gcc dot gnu.org
2023-06-27 9:37 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-27 6:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110414
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
Blocks| |109849
Keywords| |missed-optimization
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109849
[Bug 109849] suboptimal code for vector walking loop
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/110414] [14 Regression] Dead Code Elimination Regression since r14-1127-g9e2017ae6ac
2023-06-26 15:06 [Bug tree-optimization/110414] New: [14 Regression] Dead Code Elimination Regression since r14-1127-g9e2017ae6ac theodort at inf dot ethz.ch
2023-06-27 6:33 ` [Bug tree-optimization/110414] " rguenth at gcc dot gnu.org
@ 2023-06-27 9:37 ` rguenth at gcc dot gnu.org
2024-03-08 15:30 ` law at gcc dot gnu.org
2024-05-07 7:40 ` [Bug tree-optimization/110414] [14/15 " rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-27 9:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110414
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2023-06-27
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
DOM3 removes the call in GCC 13 and the cause looks pretty similar to PR110413,
we lose a __builtin_unreachable () early.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/110414] [14 Regression] Dead Code Elimination Regression since r14-1127-g9e2017ae6ac
2023-06-26 15:06 [Bug tree-optimization/110414] New: [14 Regression] Dead Code Elimination Regression since r14-1127-g9e2017ae6ac theodort at inf dot ethz.ch
2023-06-27 6:33 ` [Bug tree-optimization/110414] " rguenth at gcc dot gnu.org
2023-06-27 9:37 ` rguenth at gcc dot gnu.org
@ 2024-03-08 15:30 ` law at gcc dot gnu.org
2024-05-07 7:40 ` [Bug tree-optimization/110414] [14/15 " rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-08 15:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110414
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] 5+ messages in thread
* [Bug tree-optimization/110414] [14/15 Regression] Dead Code Elimination Regression since r14-1127-g9e2017ae6ac
2023-06-26 15:06 [Bug tree-optimization/110414] New: [14 Regression] Dead Code Elimination Regression since r14-1127-g9e2017ae6ac theodort at inf dot ethz.ch
` (2 preceding siblings ...)
2024-03-08 15:30 ` law at gcc dot gnu.org
@ 2024-05-07 7:40 ` rguenth at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-07 7:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110414
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|14.0 |14.2
--- Comment #2 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] 5+ messages in thread
end of thread, other threads:[~2024-05-07 7:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-26 15:06 [Bug tree-optimization/110414] New: [14 Regression] Dead Code Elimination Regression since r14-1127-g9e2017ae6ac theodort at inf dot ethz.ch
2023-06-27 6:33 ` [Bug tree-optimization/110414] " rguenth at gcc dot gnu.org
2023-06-27 9:37 ` rguenth at gcc dot gnu.org
2024-03-08 15:30 ` law at gcc dot gnu.org
2024-05-07 7:40 ` [Bug tree-optimization/110414] [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).