From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BB8173857815; Tue, 17 May 2022 07:32:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB8173857815 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/105618] [11/12/13 Regression] Missed loop body simplification by -O3 (trunk v.s. 10.3) Date: Tue, 17 May 2022 07:32:09 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization, needs-bisection X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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: Tue, 17 May 2022 07:32:09 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105618 --- Comment #3 from Richard Biener --- There was quite some massaging in handling of PHI uses, notably we now have /* For PHI nodes the block we know sth about is the incoming block with the use. */ if (gimple_code (use_stmt) =3D=3D GIMPLE_PHI) { /* In case the PHI node post-dominates the current insert location we can disregard it. But make sure it is not dominating it as well as can happen in a CFG cycle. */ if (commondom !=3D bb && !dominated_by_p (CDI_DOMINATORS, commondom, bb) && dominated_by_p (CDI_POST_DOMINATORS, commondom, bb) /* If the blocks are possibly within the same irreduc= ible cycle the above check breaks down. */ && !((bb->flags & commondom->flags & BB_IRREDUCIBLE_L= OOP) && bb->loop_father =3D=3D commondom->loop_father) && !((commondom->flags & BB_IRREDUCIBLE_LOOP) && flow_loop_nested_p (commondom->loop_father, bb->loop_father)) && !((bb->flags & BB_IRREDUCIBLE_LOOP) && flow_loop_nested_p (bb->loop_father, commondom->loop_father))) continue; and already the first !dominated_by_p (CDI_DOMINATORS, commondom, bb) check makes us not consider the sink opportunity. That was introduced as part of the fix for PR97330.=