public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "linkw at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-105940-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105940

            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]
            = 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) == 2
           && LOOP_REQUIRES_VERSIONING (loop_vinfo))
         m_costs[vect_body] += 10000;
+
+      m_suggested_unroll_factor = 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 += a[d * c] * e;
  b = g;
}

option: -Ofast -mcpu=power10

             reply	other threads:[~2022-06-13  5:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-13  5:59 linkw at gcc dot gnu.org [this message]
2022-06-13  6:07 ` [Bug tree-optimization/105940] " linkw at gcc dot gnu.org
2022-06-13  6:08 ` linkw at gcc dot gnu.org
2022-06-13  8:25 ` rguenth at gcc dot gnu.org
2022-06-14  5:58 ` cvs-commit at gcc dot gnu.org
2022-06-14  8:46 ` linkw at gcc dot gnu.org
2022-06-15 10:13 ` cvs-commit at gcc dot gnu.org
2022-06-16 13:33 ` linkw at gcc dot gnu.org
2022-06-16 13:35 ` linkw at gcc dot gnu.org
2022-06-17 10:56 ` linkw at gcc dot gnu.org
2022-06-20 12:45 ` cvs-commit at gcc dot gnu.org
2022-06-23  1:59 ` cvs-commit at gcc dot gnu.org
2022-06-23  2:25 ` cvs-commit at gcc dot gnu.org
2022-06-23  3:20 ` linkw at gcc dot gnu.org
2022-06-23  6:28 ` rguenther at suse dot de

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-105940-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).