From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2D7943858D32; Mon, 22 Jan 2024 16:16:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2D7943858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705940175; bh=x8vx9AMFvq8i55aX/qKChEYECcWWjvRIa1wPeLuGFo4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XPLcliz7fATthQM0DgERmYNDeKwtd1sIK1KmDyGOfcW7tQxuOXtfyRGfFjhy2JuOx q+mtb/lfkoqQntanWlBDY5kMs18Z7p2IOySyqmsT57g5IOtyzRZaRL2jQVtmVQqkKI cXksKRNwVFR9Q/KM3QO2vT82ZZ0FAueNv1UCAv6Y= From: "tnfchris 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: Mon, 22 Jan 2024 16:16:14 +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: tnfchris 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 #9 from Tamar Christina --- So on SVE the change is cost modelling. Bisect landed on g:33c2b70dbabc02788caabcbc66b7baeafeb95bcf which changed t= he compiler's defaults to using the new throughput matched cost modelling used= be newer cores. It looks like this changes which mode the compiler picks for when using a f= ixed register size. This is because the new cost model (correctly) models the costs for FMAs and promotions. Before: array1[0][_1] 1 times scalar_load costs 1 in prologue int) _2 1 times scalar_stmt costs 1 in prologue after: array1[0][_1] 1 times scalar_load costs 1 in prologue=20 (int) _2 1 times scalar_stmt costs 0 in prologue=20 and the cost goes from: Vector inside of loop cost: 125 to Vector inside of loop cost: 83=20 so far, nothing sticks out, and in fact the profitability for VNx4QI drops = from Calculated minimum iters for profitability: 5 to Calculated minimum iters for profitability: 3 This causes a clash, as this is now exactly the same cost as VNx2QI which u= sed to be what it preferred before. Which then leads it to pick the higher VF. In the end smaller VF shows: ;; Guessed iterations of loop 4 is 0.500488. New upper bound 1. and now we get: Vectorization factor 16 seems too large for profile prevoiusly believed to = be consistent; reducing.=20=20 ;; Guessed iterations of loop 4 is 0.500488. New upper bound 0. ;; Scaling loop 4 with scale 66.6% (guessed) to reach upper bound 0 which I guess is the big difference. There is a weird costing going on in the PHI nodes though: 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 prologue they have collapsed to 0. which can't be right..=