public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111457] New: [14 Regression] Dead Code Elimination Regression since r14-3407-g936a12331a2
@ 2023-09-18  9:50 theodort at inf dot ethz.ch
  2023-09-18 10:40 ` [Bug tree-optimization/111457] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: theodort at inf dot ethz.ch @ 2023-09-18  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111457
           Summary: [14 Regression] Dead Code Elimination Regression since
                    r14-3407-g936a12331a2
           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/j4M8z8MzK

Given the following code:

void foo(void);
static int a, b, c, d, h;
static short i;
static void e(int f) {
    int g = -16;
    for (; g != -6; g = g + 5) {
        b = 6;
        if (!(((f) >= 1) && ((f) <= 26))) {
            __builtin_unreachable();
        }
        f = 0;
        for (; f < 26; ++f)
            if (a) {
                foo();
                break;
            }
        d = 0;
    }
}
int main() {
    a = 0;
    e(0 == i);
    h = d;
    c = b;
}

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

main:
        movl    $0, a(%rip)
        pushq   %rbx
        movl    $2, %ebx
.L3:
        movl    $6, b(%rip)
        movl    a(%rip), %eax
        testl   %eax, %eax
        je      .L2
        call    foo
.L2:
        movl    $0, d(%rip)
        cmpl    $1, %ebx
        jne     .L4
        xorl    %eax, %eax
        popq    %rbx
        ret
        .p2align 4,,10
        .p2align 3
.L4:
        movl    $1, %ebx
        jmp     .L3

gcc-13.2.0 -O2 eliminates the call to foo:

main:
        movl    $0, a(%rip)
        xorl    %eax, %eax
        movl    $6, b(%rip)
        movl    $0, d(%rip)
        ret

Bisects to r14-3407-g936a12331a2

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

* [Bug tree-optimization/111457] [14 Regression] Dead Code Elimination Regression since r14-3407-g936a12331a2
  2023-09-18  9:50 [Bug tree-optimization/111457] New: [14 Regression] Dead Code Elimination Regression since r14-3407-g936a12331a2 theodort at inf dot ethz.ch
@ 2023-09-18 10:40 ` rguenth at gcc dot gnu.org
  2023-11-24  4:39 ` pinskia at gcc dot gnu.org
  2024-02-13 15:34 ` pheeck at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-09-18 10:40 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

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

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

* [Bug tree-optimization/111457] [14 Regression] Dead Code Elimination Regression since r14-3407-g936a12331a2
  2023-09-18  9:50 [Bug tree-optimization/111457] New: [14 Regression] Dead Code Elimination Regression since r14-3407-g936a12331a2 theodort at inf dot ethz.ch
  2023-09-18 10:40 ` [Bug tree-optimization/111457] " rguenth at gcc dot gnu.org
@ 2023-11-24  4:39 ` pinskia at gcc dot gnu.org
  2024-02-13 15:34 ` pheeck at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-24  4:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks like this one has been fixed.

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

* [Bug tree-optimization/111457] [14 Regression] Dead Code Elimination Regression since r14-3407-g936a12331a2
  2023-09-18  9:50 [Bug tree-optimization/111457] New: [14 Regression] Dead Code Elimination Regression since r14-3407-g936a12331a2 theodort at inf dot ethz.ch
  2023-09-18 10:40 ` [Bug tree-optimization/111457] " rguenth at gcc dot gnu.org
  2023-11-24  4:39 ` pinskia at gcc dot gnu.org
@ 2024-02-13 15:34 ` pheeck at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pheeck at gcc dot gnu.org @ 2024-02-13 15:34 UTC (permalink / raw)
  To: gcc-bugs

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

Filip Kastl <pheeck at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pheeck at gcc dot gnu.org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
           Keywords|needs-bisection             |

--- Comment #2 from Filip Kastl <pheeck at gcc dot gnu.org> ---
Indeed. Current trunk successfully eliminates the call to foo.

gcc testcase.c -S -O2

main: 
        movl    $0, a(%rip)    
        xorl    %eax, %eax    
        movl    $6, b(%rip)    
        movl    $0, d(%rip)    
        ret

Setting this as fixed.

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

end of thread, other threads:[~2024-02-13 15:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-18  9:50 [Bug tree-optimization/111457] New: [14 Regression] Dead Code Elimination Regression since r14-3407-g936a12331a2 theodort at inf dot ethz.ch
2023-09-18 10:40 ` [Bug tree-optimization/111457] " rguenth at gcc dot gnu.org
2023-11-24  4:39 ` pinskia at gcc dot gnu.org
2024-02-13 15:34 ` pheeck 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).