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 tree-optimization/106280] New: dom_oracle::register_transitives is expensive for deep dominator trees
Date: Wed, 13 Jul 2022 08:29:42 +0000	[thread overview]
Message-ID: <bug-106280-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 106280
           Summary: dom_oracle::register_transitives is expensive for deep
                    dominator trees
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

For testcases like

extern int foo (int);

int bar(int flag)
{
  int res = 0;
#define A \
  for (int i = 0; i < 1024; ++i) if (flag) res ^= foo(i);
#define B A A A A A A A A A A
#define C B B B B B B B B B B
#define D C C C C C C C C C C
  D D D D
  return res;
}

the function shows high up in the profiles even at -O1 (via the DOM pass
I guess which also has its own share of issues with this).

The

  for (bb = root_bb; bb; bb = get_immediate_dominator (CDI_DOMINATORS, bb))
    {
...
    }

walk visits a lot of blocks and I suppose it does that for each block
in the dominator chain when that ends in something useful.  Another
testcase might be of the CFG structure

 if (a)
   if (b)
     if (c)
       if (d)
         ...

where for each if () we'd walk up the dominator tree.

I suggest to limit the walking depth to a constant depth (there is for example
--param max-hoist-depth with similar limiting, but for children).

There might be similar walks elsewhere in the relation/ranger code.

             reply	other threads:[~2022-07-13  8:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13  8:29 rguenth at gcc dot gnu.org [this message]
2022-07-14 17:03 ` [Bug tree-optimization/106280] " amacleod at redhat dot com
2022-07-18 20:01 ` cvs-commit 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-106280-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).