From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BF8343858400; Wed, 29 Dec 2021 20:47:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BF8343858400 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/103742] [12 Regression] '-fcompare-debug' failure (length) with -O2 -fnon-call-exceptions --param=early-inlining-insns=82 since r12-5301-g045206450386bcd7 Date: Wed, 29 Dec 2021 20:47:10 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 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: Wed, 29 Dec 2021 20:47:10 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103742 --- Comment #5 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:e5acfcad98f3fa33e141f4e6bc06f7d7c13496e1 commit r12-6146-ge5acfcad98f3fa33e141f4e6bc06f7d7c13496e1 Author: Jakub Jelinek Date: Wed Dec 29 21:46:21 2021 +0100 tree-ssa-dce: Fix up -fcompare-debug failures in make_forwarders_with_degenerate_phis [PR103742] make_forwarders_with_degenerate_phis causes a -fcompare-debug failure on the following testcase. The problem is that on: # iftmp.4_8 =3D PHI <&D.2582(6), &D.2583(4), &D.2582(7), &D.2583(5)> the exact DECL_UIDs are different between -g and -g0 (which is ok, with= -g the decls can have larger gaps in between the uids), which means iterative_hash_expr is different and because there are 2 pairs of edges with matching phi arguments, the function processes them in different orders. The following patch fixes it by using the iterative_hash_expr order only to determine which arguments are the same, then replaces the hashes with the minimum dest_idx in the set of matching arguments and qsorts again (which makes it stable for -fcompare-debug) and only splits edges etc. on that stable order. As a small optimization, if no arguments are equal, it doesn't do the second qsort and continues, and if all arguments of the PHI are constants or SSA_NAMEs (I think that is a pretty common case for many PHIs), then it doesn't do the second qsort either, because in that case the hash values will be stable, only computed from the constant values = or SSA_NAME_VERSIONs. 2021-12-29 Jakub Jelinek PR debug/103742 * tree-ssa-dce.c (make_forwarders_with_degenerate_phis): If any= phi argument is not CONSTANT_CLASS_P or SSA_NAME and any arguments = are equal, change second from hash value to lowest dest_idx from the edges which have equal argument and resort to ensure -fcompare-debug stability. * g++.dg/opt/pr103742.C: New test.=