From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0A42238582A6; Mon, 13 Jun 2022 05:59:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0A42238582A6 From: "linkw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/105940] New: suggested_unroll_factor applying place looks wrong Date: Mon, 13 Jun 2022 05:59:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: linkw 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Mon, 13 Jun 2022 05:59:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105940 Bug ID: 105940 Summary: suggested_unroll_factor applying place looks wrong Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: linkw at gcc dot gnu.org Target Milestone: --- I tried to evaluate if we can get some performance gains by setting suggested_unroll_factor on Power, but met one ICE coming from the line: cached_vf_per_mode[last_mode_i] =3D exact_div (LOOP_VINFO_VECT_FACTOR (loop_vinfo), loop_vinfo->suggested_unroll_factor); With below simple hacking in rs6000 backend: diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index d7a7cfe860f..dcf2e8fc0ba 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -5490,6 +5490,8 @@ rs6000_cost_data::finish_cost (const vector_costs *scalar_costs) && LOOP_VINFO_VECT_FACTOR (loop_vinfo) =3D=3D 2 && LOOP_REQUIRES_VERSIONING (loop_vinfo)) m_costs[vect_body] +=3D 10000; + + m_suggested_unroll_factor =3D 4; } vector_costs::finish_cost (scalar_costs); We can get the ICE reproduced on the below reduced test case: _Complex *a; _Complex b, e; int c, d; void f() { _Complex g; for (; d; d++) g +=3D a[d * c] * e; b =3D g; } option: -Ofast -mcpu=3Dpower10=