public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111326] New: [14 Regression] Dead Code Elimination Regression since r14-376-g47a76439911
@ 2023-09-07 12:47 theodort at inf dot ethz.ch
  2023-09-07 13:25 ` [Bug tree-optimization/111326] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: theodort at inf dot ethz.ch @ 2023-09-07 12:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111326

            Bug ID: 111326
           Summary: [14 Regression] Dead Code Elimination Regression since
                    r14-376-g47a76439911
           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/fv3szWMTE

Given the following code:

void foo(void);
static int a = 253, d, e, f, h, i, k;
static char j, m;
static short l, n;
static char(o)(char b, char c) { return b + c; }
void(p)(int);
short(q)(short);
static short(r)(int g) {
    if (!(((g) >= 253) && ((g) <= 253))) {
        __builtin_unreachable();
    }
    return 0;
}
static void s(char ab, short) {
    int ac;
    ab = 27;
    for (; ab > 13; ab = ab - 9) {
        j |= 10 | ac;
        e = 0;
        if (o(ab ^ a, d)) {
            --l;
            f = 0;
            if (a)
                ;
            else {
                p(i);
                k ^= q(0);
            }
            i = 5;
        } else {
            ac = 0;
            for (; ac <= 38; ac = ac + 5) foo();
            k = h &= 0 >= 0;
            n = 0;
        }
    }
}
static unsigned t() {
    s(m, a);
    if (l)
        ;
    else
        r(3);
    return f;
}
int main() {
    d = a;
    t();
    r(a);
    printf("", e, n);
}

gcc-trunk -O3 does not eliminate the call to foo:

main:
        pushq   %rbp
        movl    $253, %edx
        movl    $27, %ebp
        pushq   %rbx
        subq    $8, %rsp
        movl    $253, d(%rip)
.L5:
        movl    %ebp, %eax
        orb     $42, j(%rip)
        movl    $0, e(%rip)
        xorl    $-3, %eax
        addb    %dl, %al
        je      .L6
        subw    $1, l(%rip)
        movl    $0, f(%rip)
        movl    $5, i(%rip)
.L3:
        cmpb    $18, %bpl
        je      .L4
        movl    d(%rip), %edx
        movl    $18, %ebp
        jmp     .L5
        .p2align 4,,10
        .p2align 3
.L4:
        movswl  n(%rip), %edx
        movl    e(%rip), %esi
        movl    $.LC0, %edi
        xorl    %eax, %eax
        call    printf
        addq    $8, %rsp
        xorl    %eax, %eax
        popq    %rbx
        popq    %rbp
        ret
.L6:
        movl    $8, %ebx
.L2:
        call    foo
        call    foo
        subl    $2, %ebx
        jne     .L2
        movw    $0, n(%rip)
        movl    h(%rip), %eax
        andl    $1, %eax
        movl    %eax, h(%rip)
        movl    %eax, k(%rip)
        jmp     .L3

gcc-13.2.0 -O3 eliminates the call to foo:

main:
        subq    $8, %rsp
        movswl  n(%rip), %edx
        xorl    %esi, %esi
        xorl    %eax, %eax
        movl    $.LC0, %edi
        orb     $42, j(%rip)
        subw    $2, l(%rip)
        movl    $253, d(%rip)
        movl    $0, e(%rip)
        movl    $0, f(%rip)
        movl    $5, i(%rip)
        call    printf
        xorl    %eax, %eax
        addq    $8, %rsp
        ret

Bisects to r14-376-g47a76439911

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/111326] [14 Regression] Dead Code Elimination Regression since r14-376-g47a76439911
  2023-09-07 12:47 [Bug tree-optimization/111326] New: [14 Regression] Dead Code Elimination Regression since r14-376-g47a76439911 theodort at inf dot ethz.ch
@ 2023-09-07 13:25 ` pinskia at gcc dot gnu.org
  2023-10-25 23:08 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-07 13:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111326

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/111326] [14 Regression] Dead Code Elimination Regression since r14-376-g47a76439911
  2023-09-07 12:47 [Bug tree-optimization/111326] New: [14 Regression] Dead Code Elimination Regression since r14-376-g47a76439911 theodort at inf dot ethz.ch
  2023-09-07 13:25 ` [Bug tree-optimization/111326] " pinskia at gcc dot gnu.org
@ 2023-10-25 23:08 ` pinskia at gcc dot gnu.org
  2024-03-07 23:21 ` law at gcc dot gnu.org
  2024-05-07  7:41 ` [Bug tree-optimization/111326] [14/15 " rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-25 23:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111326

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-10-25
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/111326] [14 Regression] Dead Code Elimination Regression since r14-376-g47a76439911
  2023-09-07 12:47 [Bug tree-optimization/111326] New: [14 Regression] Dead Code Elimination Regression since r14-376-g47a76439911 theodort at inf dot ethz.ch
  2023-09-07 13:25 ` [Bug tree-optimization/111326] " pinskia at gcc dot gnu.org
  2023-10-25 23:08 ` pinskia at gcc dot gnu.org
@ 2024-03-07 23:21 ` law at gcc dot gnu.org
  2024-05-07  7:41 ` [Bug tree-optimization/111326] [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-07 23:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111326

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/111326] [14/15 Regression] Dead Code Elimination Regression since r14-376-g47a76439911
  2023-09-07 12:47 [Bug tree-optimization/111326] New: [14 Regression] Dead Code Elimination Regression since r14-376-g47a76439911 theodort at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2024-03-07 23:21 ` law at gcc dot gnu.org
@ 2024-05-07  7:41 ` 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:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111326

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:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-07 12:47 [Bug tree-optimization/111326] New: [14 Regression] Dead Code Elimination Regression since r14-376-g47a76439911 theodort at inf dot ethz.ch
2023-09-07 13:25 ` [Bug tree-optimization/111326] " pinskia at gcc dot gnu.org
2023-10-25 23:08 ` pinskia at gcc dot gnu.org
2024-03-07 23:21 ` law at gcc dot gnu.org
2024-05-07  7:41 ` [Bug tree-optimization/111326] [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).