public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/114579] New: RTL expansion add_scope_conflicts is slow
Date: Thu, 04 Apr 2024 08:54:14 +0000	[thread overview]
Message-ID: <bug-114579-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 114579
           Summary: RTL expansion add_scope_conflicts is slow
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

For the testcase in PR114480 at -O1 we see

>  expand vars                        :   9.19 (  9%)
>  expand                             :  14.26 ( 15%)

or worse percentages after recent improvements in other areas.  The main
compile-time is spent in a lot of bitmap_ior calls which almost all
originate from add_scope_conflicts_1 doing

          if (for_conflict && visit == visit_op)
            {
              /* If this is the first real instruction in this BB we need
                 to add conflicts for everything live at this point now.
                 Unlike classical liveness for named objects we can't
                 rely on seeing a def/use of the names we're interested in.
                 There might merely be indirect loads/stores.  We'd not add any
                 conflicts for such partitions.  */
              bitmap_iterator bi;
              unsigned i;
              EXECUTE_IF_SET_IN_BITMAP (work, 0, i, bi)
                {
                  class stack_var *a = &stack_vars[i];
                  if (!a->conflicts)
                    a->conflicts = BITMAP_ALLOC (&stack_var_bitmap_obstack);
                  bitmap_ior_into (a->conflicts, work);

the testcase has a lot of live variables and this piece is obviously
quadratic in this.  A better representation than a conflict bitmap might
be a O(n) unification leader map.  But of course unifying two conflict sets
is then O(number-of-vars) unless you do this on-demand like PTAs 'find'
where query works recursively, updating leaders on demand.

             reply	other threads:[~2024-04-04  8:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-04  8:54 rguenth at gcc dot gnu.org [this message]
2024-04-04  9:52 ` [Bug middle-end/114579] " rguenth at gcc dot gnu.org
2024-04-05 18:44 ` pinskia at gcc dot gnu.org
2024-05-02  6:32 ` cvs-commit at gcc dot gnu.org
2024-05-02 11:34 ` rguenth at gcc dot gnu.org

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-114579-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).