public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/104530] New: [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs. 11.2.0)
@ 2022-02-14 16:40 theodort at inf dot ethz.ch
  2022-02-14 16:47 ` [Bug tree-optimization/104530] " jakub at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: theodort at inf dot ethz.ch @ 2022-02-14 16:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104530
           Summary: [12 Regression] Dead Code Elimination Regression at
                    -O3 (trunk vs. 11.2.0)
           Product: gcc
           Version: 12.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: ---

Dead Code Elimination Regression at -O3 (trunk vs.
a7fede6704dd207fb32b97bc30f945acc7b953c5) 138751
---------------
cat case.c #138751
void foo(void);

static int a, *b = &a, c, d = 1;

int main() {
    c = 0 == b;
    a = *b;
    if (c % d)
        for (; d; --d)
            foo();
    b = 0;
}

gcc-58aeb75d4097010ad9bb72b964265b18ab284f93 (trunk) -O3 can not eliminate foo
but gcc-11.2.0 -O3 can.

gcc-58aeb75d4097010ad9bb72b964265b18ab284f93 (trunk) -O3 -S -o /dev/stdout
case.c
--------- OUTPUT ---------
main:
.LFB0:
        .cfi_startproc
        movq    b(%rip), %rax
        testq   %rax, %rax
        movl    (%rax), %edx
        sete    %al
        movzbl  %al, %eax
        movl    %edx, a(%rip)
        cltd
        idivl   d(%rip)
        testl   %edx, %edx
        je      .L9
        pushq   %rax
        .cfi_def_cfa_offset 16
        .p2align 4,,10
        .p2align 3
.L3:
        call    foo
        subl    $1, d(%rip)
        jne     .L3
        xorl    %ecx, %ecx
        xorl    %eax, %eax
        movq    %rcx, b(%rip)
        popq    %rsi
        .cfi_def_cfa_offset 8
        ret
.L9:
        xorl    %edx, %edx
        xorl    %eax, %eax
        movq    %rdx, b(%rip)
        ret
---------- END OUTPUT ---------


gcc-11.2.0 -O3 -S -o /dev/stdout case.c
--------- OUTPUT ---------

main:
.LFB0:
        .cfi_startproc
        movq    b(%rip), %rax
        movq    $0, b(%rip)
        movl    (%rax), %eax
        movl    %eax, a(%rip)
        xorl    %eax, %eax
        ret
---------- END OUTPUT ---------


Bisects to:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=c6bb1db76b3ac127aff7dacf391fc1798a94bb7d

----- Build information -----
----- 58aeb75d4097010ad9bb72b964265b18ab284f93 (trunk)
Target: x86_64-pc-linux-gnu
Configured with: ../configure --disable-multilib --disable-bootstrap
--enable-languages=c,c++
--prefix=/zdata/compiler_cache/gcc-58aeb75d4097010ad9bb72b964265b18ab284f93
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.1 20220213 (experimental) (GCC)

----- releases/gcc-11.2.0
Target: x86_64-pc-linux-gnu
Configured with: ../configure --disable-multilib --disable-bootstrap
--enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0   (GCC)

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

end of thread, other threads:[~2022-11-08  0:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14 16:40 [Bug tree-optimization/104530] New: [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs. 11.2.0) theodort at inf dot ethz.ch
2022-02-14 16:47 ` [Bug tree-optimization/104530] " jakub at gcc dot gnu.org
2022-02-15 23:14 ` amacleod at redhat dot com
2022-02-21 13:10 ` jakub at gcc dot gnu.org
2022-04-19 15:36 ` rguenth at gcc dot gnu.org
2022-05-06  8:32 ` [Bug tree-optimization/104530] [12/13 " jakub at gcc dot gnu.org
2022-11-08  0:22 ` cvs-commit at gcc dot gnu.org
2022-11-08  0:23 ` amacleod at redhat dot com

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).