From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0F0103858408; Thu, 29 Feb 2024 10:17:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0F0103858408 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709201849; bh=A2KH2kdUIkBMqYcgzdL66BxZZoG71WLbZAlj6Oxe0wU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=F5mr6eAwgO5+rPb2wQIEEaJqA8O5+qsSVJ/7n0K46DuJZane3JseiYysTBO2Wb2zw UXiHi1nXKkvtRLH/HBkUbldWZBn+cOTSBwXgjS3EVrvUl0Aj61DxxwA1soxA1cmooB UuUO4qkJeUtQpX5q/vtH9O9YwqYFUU7D9POnM4Fc= From: "stefansf at linux dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113994] [13/14 Regression] Probable C++ code generation bug with -O2 on s390x platform Date: Thu, 29 Feb 2024 10:17:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: stefansf at linux dot ibm.com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113994 --- Comment #6 from Stefan Schulze Frielinghaus --- Looks like wrong liveness information. The problem is that df_analyze_loop only considers basic blocks which strictly belong to a loop which is not enough. During loop2_doloop basic block 9 (previously 8) embodies the CC consumer jump_insn 42 and is not part of the loop and therefore does not contribute to the liveness analysis. A quick and dirty experiment by forci= ng a merge with BB 9 diff --git a/gcc/df-core.cc b/gcc/df-core.cc index f0eb4c93957..79f37e22ec1 100644 --- a/gcc/df-core.cc +++ b/gcc/df-core.cc @@ -957,9 +957,11 @@ df_worklist_propagate_backward (struct dataflow *dataf= low, if (EDGE_COUNT (bb->succs) > 0) FOR_EACH_EDGE (e, ei, bb->succs) { - if (bbindex_to_postorder[e->dest->index] < last_change_age.length () + if ((bbindex_to_postorder[e->dest->index] < last_change_age.length = () && age <=3D last_change_age[bbindex_to_postorder[e->dest->index= ]] && bitmap_bit_p (considered, e->dest->index)) + || (strcmp ("loop2_doloop", current_pass->name) =3D=3D 0 + && e->src->index =3D=3D 6 && e->dest->index =3D=3D 9)) changed |=3D dataflow->problem->con_fun_n (e); } else if (dataflow->problem->con_fun_0) shows that, now, CC is live at BB 6 and therefore doloop performs no transformation due to bool fail =3D bitmap_intersect_p (df_get_live_out (loop_end), modified); BITMAP_FREE (modified); if (fail) { if (dump_file) fprintf (dump_file, "Doloop: doloop pattern clobbers live out\n"); return false; } In a first try I enlarged the set of basic blocks for which df_analyze_loop= is run to also include basic blocks which have a direct edge originating from a basic block of a loop. Of course, this solves this problem. However, in general this may not be enough. I'm wondering what the IL allows. Is it possible to have a graph containing not only outgoing edges of a loop but a= lso ingoing? If so I think we would need to compute the set of basic blocks wh= ich are reachable from within the loop. Any thoughts?=