From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4E4993858D32; Tue, 23 Jan 2024 06:42:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E4993858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705992159; bh=2S1xSWGnAvxKYGLe+4pE9ygO6KLHrS6JcXtwIjn4/F0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cjzxaeC3YK/3/1FrWNYGhSfp6kjzYG/ahcr+W6s0ykbQjh1YKneyjnJrodYBtgJqA ov9/25cZP/nYZvpiGODwU/K9Jy/jN0zmd9EK6d7r/PPGA/+Hmqobess+4JIsW2tkXK UZ8TK0ORc4YMJm/+/m6o/AMMFwxAEB/dEn6qycb8= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113441] [14 Regression] Fail to fold the last element with multiple loop Date: Tue, 23 Jan 2024 06:42:38 +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: 14.0 X-Bugzilla-Keywords: missed-optimization, needs-bisection X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org 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: 14.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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113441 --- Comment #11 from Richard Biener --- (In reply to Tamar Christina from comment #9) > There is a weird costing going on in the PHI nodes though: >=20 > m_108 =3D PHI 1 times vector_stmt costs 0 in body=20 > m_108 =3D PHI 2 times scalar_to_vec costs 0 in prolo= gue >=20 > they have collapsed to 0. which can't be right.. Note this is likely because of the backend going wrong. bool vectorizable_phi (vec_info *, stmt_vec_info stmt_info, gimple **vec_stmt, slp_tree slp_node, stmt_vector_for_cost *cost_vec) { .. /* For single-argument PHIs assume coalescing which means zero cost for the scalar and the vector PHIs. This avoids artificially favoring the vector path (but may pessimize it in some cases). */ if (gimple_phi_num_args (as_a (stmt_info->stmt)) > 1) record_stmt_cost (cost_vec, SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node), vector_stmt, stmt_info, vectype, 0, vect_body); You could check if we call this with sane values.=