From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8B4BD3858407; Wed, 11 Jan 2023 13:16:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B4BD3858407 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673442962; bh=2oI7XFb5ODGUAjhc6nkvSv3pVu96DldqY6OyukWakIg=; h=From:To:Subject:Date:From; b=dxumUPnobWlJRuQMZpg1TCp1b6/J9WpIowUFSmvWmSQ/Bu4Z3/s44UBYwZEzkpgpb atR5ZzOJ6xgC3370OHE1lbzLoNBMgnYjcB33bLlmRgkHrGSLxZI0ihpTFArFCp8vjT ECueIWQ/bW7C/Gzl//SWButY2GlyzZrqrHYs0ri8= From: "yann at ywg dot ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108368] New: [13 Regression] Dead Code Elimination Regression at -O3 since r13-1759-gdbb093f4f15 Date: Wed, 11 Jan 2023 13:16:01 +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: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: yann at ywg dot 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 attachments.created 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108368 Bug ID: 108368 Summary: [13 Regression] Dead Code Elimination Regression at -O3 since r13-1759-gdbb093f4f15 Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: yann at ywg dot ch Target Milestone: --- Created attachment 54244 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D54244&action=3Dedit Case file cat case.c #1409 int a; int b; short c; static int d =3D 4; void foo(); void e(int f) {} int main() { unsigned g =3D -27; for (; g > 7; ++g) { e(c && g); b ? 0 : a; if (g) { if (0 >=3D d) foo(); } else d =3D 0; } } `gcc-f99d7d669eaa2830eb5878df4da67e77ec791522 (trunk) -O3` can not eliminate `foo` but `gcc-releases/gcc-12.2.0 -O3` can. `gcc-f99d7d669eaa2830eb5878df4da67e77ec791522 (trunk) -O3 -S -o /dev/stdout case.c` --------- OUTPUT --------- main: .LFB1: .cfi_startproc pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset 3, -16 movl $27, %ebx .L5: movl d(%rip), %eax testl %eax, %eax jle .L8 .L4: xorl %eax, %eax popq %rbx .cfi_remember_state .cfi_def_cfa_offset 8 ret .p2align 4,,10 .p2align 3 .L8: .cfi_restore_state xorl %eax, %eax call foo subl $1, %ebx jne .L5 jmp .L4 ---------- END OUTPUT --------- `gcc-releases/gcc-12.2.0 -O3 -S -o /dev/stdout case.c` --------- OUTPUT --------- main: .LFB1: .cfi_startproc xorl %eax, %eax ret ---------- END OUTPUT --------- Bisects to: r13-1759-gdbb093f4f15 commit dbb093f4f15ea66f2ce5cd2dc1903a6894563356 Author: Andrew MacLeod Date: Mon Jul 18 15:04:23 2022 -0400 Resolve complicated join nodes in range_from_dom. Join nodes which carry outgoing ranges on incoming edges are uncommon, but can still be resolved by setting the dominator range, and then calculating incoming edges. Avoid doing so if one of the incoing edges is not dominated by the same dominator. * gimple-range-cache.cc (ranger_cache::range_from_dom): Check for incoming ranges on join nodes and add to worklist.=