From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 29D4B3858C50; Tue, 23 Jan 2024 08:15:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29D4B3858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705997736; bh=CpKQVTCLAknpqbbCkXVNVoRevagjpSWREiVORNgZHG0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=kEQi/q1isDA/xkjG9vcAhWt56EgNhxziIYK7VRy8tVNhPvDD/PCvN4bK7P7qcT81o H3TOGq0gQVt5vKUFG1B8aK9L231kPDta1Ke0UxDKHjF5ADFUM7nLKUyLamTi6T6gMI WdPBjwVLm82jlSMN3yYEHYa+X5NWSJL7h2FXUOPs= From: "juzhe.zhong at rivai dot ai" 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 08:15:33 +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: juzhe.zhong at rivai dot ai 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 #12 from JuzheZhong --- (In reply to Richard Biener from comment #11) > (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 pro= logue > >=20 > > they have collapsed to 0. which can't be right.. >=20 > Note this is likely because of the backend going wrong. >=20 > bool > vectorizable_phi (vec_info *, > stmt_vec_info stmt_info, gimple **vec_stmt, > slp_tree slp_node, stmt_vector_for_cost *cost_vec) > { > .. >=20 > /* 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_nod= e), > vector_stmt, stmt_info, vectype, 0, vect_body); >=20 > You could check if we call this with sane values. Do you mean it's RISC-V backend cost model issue ?=