From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9A5313858C27; Mon, 14 Feb 2022 16:40:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A5313858C27 From: "theodort at inf dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104530] New: [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs. 11.2.0) Date: Mon, 14 Feb 2022 16:40:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: theodort 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 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: Mon, 14 Feb 2022 16:40:13 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104530 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 =3D &a, c, d =3D 1; int main() { c =3D 0 =3D=3D b; a =3D *b; if (c % d) for (; d; --d) foo(); b =3D 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=3Dgcc.git;a=3Dcommit;h=3Dc6bb1db76b3ac127aff7dac= f391fc1798a94bb7d ----- Build information ----- ----- 58aeb75d4097010ad9bb72b964265b18ab284f93 (trunk) Target: x86_64-pc-linux-gnu Configured with: ../configure --disable-multilib --disable-bootstrap --enable-languages=3Dc,c++ --prefix=3D/zdata/compiler_cache/gcc-58aeb75d4097010ad9bb72b964265b18ab284f= 93 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=3Dc,c++ Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.0.0 (GCC)=