public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/102892] New: [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)
@ 2021-10-22  9:39 theodort at inf dot ethz.ch
  2021-10-22  9:48 ` [Bug tree-optimization/102892] " aldyh at gcc dot gnu.org
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: theodort at inf dot ethz.ch @ 2021-10-22  9:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102892
           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: ---

cat test.c
static long b[2][1] = {0};
void bar(void);
void foo(void);
int main() {
  long c = 0;
  for (long a; a < 1; ++a)
    for (; c <= 1; c++) {
      bar();
      if (1 == b[c][0])
        foo();
    }
}

11.2.0 at -O3 can eliminate the call to foo but trunk at -O3 cannot:

gcc-11 -O3 -S test.c -o /dev/stdout
...
main:
.LFB0:
        .cfi_startproc
        subq    $8, %rsp
        .cfi_def_cfa_offset 16
        call    bar
        call    bar
        xorl    %eax, %eax
        addq    $8, %rsp
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc

gcc-trunk-O3 -S test.c -o /dev/stdout
main:
.LFB0:
        .cfi_startproc
        pushq   %rbx
        .cfi_def_cfa_offset 16
        .cfi_offset 3, -16
        xorl    %ebx, %ebx
        call    bar
        cmpq    $1, b(,%rbx,8)
        je      .L11
        .p2align 4,,10
        .p2align 3
.L3:
        cmpq    $1, %rbx
        je      .L12
.L5:
        call    bar
        movl    $1, %ebx
        cmpq    $1, b(,%rbx,8)
        jne     .L3
.L11:
        call    foo
        cmpq    $1, %rbx
        jne     .L5
.L12:
        xorl    %eax, %eax
        popq    %rbx
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc

gcc-trunk -v
Using built-in specs.
Target: x86_64-pc-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20211022 (experimental) (GCC)

Introduced with
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=01b5038718056b024b370b74a874fbd92c5bbab3

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

end of thread, other threads:[~2022-10-19  9:43 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22  9:39 [Bug tree-optimization/102892] New: [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0) theodort at inf dot ethz.ch
2021-10-22  9:48 ` [Bug tree-optimization/102892] " aldyh at gcc dot gnu.org
2021-10-22 21:19 ` pinskia at gcc dot gnu.org
2021-10-23  9:29 ` aldyh at gcc dot gnu.org
2021-11-10 14:24 ` marxin at gcc dot gnu.org
2021-11-10 15:42 ` aldyh at gcc dot gnu.org
2021-11-10 15:46 ` marxin at gcc dot gnu.org
2021-11-10 15:52 ` aldyh at gcc dot gnu.org
2021-11-10 19:27 ` cvs-commit at gcc dot gnu.org
2022-03-28  9:18 ` ebotcazou at gcc dot gnu.org
2022-03-28 14:37 ` aldyh at gcc dot gnu.org
2022-03-28 14:55 ` jakub at gcc dot gnu.org
2022-04-22  3:04 ` jiawei at iscas dot ac.cn
2022-05-04  0:50 ` [Bug tree-optimization/102892] [12/13 " palmer at gcc dot gnu.org
2022-05-04  0:50 ` palmer at gcc dot gnu.org
2022-05-04 11:58 ` jiawei at iscas dot ac.cn
2022-05-06  8:31 ` jakub at gcc dot gnu.org
2022-07-26 13:21 ` rguenth at gcc dot gnu.org
2022-09-29 22:34 ` cvs-commit at gcc dot gnu.org
2022-10-19  9:42 ` cvs-commit at gcc dot gnu.org
2022-10-19  9:43 ` 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).