From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EF85C38618F9; Wed, 3 Mar 2021 23:11:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF85C38618F9 From: "zhendong.su at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/99373] New: [missed optimization] dead code not eliminated from short circuiting Date: Wed, 03 Mar 2021 23:11:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: zhendong.su at inf dot ethz.ch X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Mar 2021 23:11:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99373 Bug ID: 99373 Summary: [missed optimization] dead code not eliminated from short circuiting Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: zhendong.su at inf dot ethz.ch CC: marxin at gcc dot gnu.org Target Milestone: --- [538] % gcctk -v Using built-in specs. COLLECT_GCC=3Dgcctk COLLECT_LTO_WRAPPER=3D/local/suz-local/software/local/gcc-trunk/libexec/gcc= /x86_64-pc-linux-gnu/11.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-trunk/configure --disable-bootstrap --prefix=3D/local/suz-local/software/local/gcc-trunk --enable-languages=3Dc= ,c++ --disable-werror --enable-multilib --with-system-zlib Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.0.1 20210303 (experimental) [master revision d97a92dca90:bc15d73426f:9b2084db9f9917eb9b19b1eb5ec03cdcb05f349e] (GCC)=20 [539] %=20 [539] % gcctk -O3 -S -o small.s small.c [540] %=20 [540] % cat small.c extern void foo(); struct a { int b; long c; } g; static int d =3D 1; int e, *f, *h; long *i; static long j() { struct a k; struct a *m =3D &g; struct a **n[] =3D {&m}; long **l =3D 0; int o[42]; foo(); int p[] =3D {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; int *d[] =3D {&p[3]}; i =3D &k.c; long ***a[] =3D {&l}; int b[5]; f =3D &b[3]; if (e) while (1) h =3D &o[7]; return 0; } int main() { d || j(); return 0; } [541] %=20 [541] % cat small.s .file "small.c" .text .p2align 4 .type j.isra.0, @function j.isra.0: .LFB2: .cfi_startproc subq $56, %rsp .cfi_def_cfa_offset 64 xorl %eax, %eax call foo leaq 8(%rsp), %rax movq %rax, i(%rip) leaq 28(%rsp), %rax movq %rax, f(%rip) movl e(%rip), %eax testl %eax, %eax jne .L3 addq $56, %rsp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L3: .cfi_restore_state jmp .L3 .cfi_endproc .LFE2: .size j.isra.0, .-j.isra.0 .section .text.startup,"ax",@progbits .p2align 4 .globl main .type main, @function main: .LFB1: .cfi_startproc xorl %eax, %eax ret .cfi_endproc .LFE1: .size main, .-main .globl i .bss .align 8 .type i, @object .size i, 8 i: .zero 8 .globl h .align 8 .type h, @object .size h, 8 h: .zero 8 .globl f .align 8 .type f, @object .size f, 8 f: .zero 8 .globl e .align 4 .type e, @object .size e, 4 e: .zero 4 .globl g .align 16 .type g, @object .size g, 16 g: .zero 16 .ident "GCC: (GNU) 11.0.1 20210303 (experimental) [master revision d97a92dca90:bc15d73426f:9b2084db9f9917eb9b19b1eb5ec03cdcb05f349e]" .section .note.GNU-stack,"",@progbits=