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/108129] nop_atomic_bit_test_and_p is too bloated
Date: Thu, 15 Dec 2022 17:57:35 +0000	[thread overview]
Message-ID: <bug-108129-4-KK9Yn2aklA@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108129-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Alexander Monakov from comment #0)
> match.pd has multi-pattern matcher 'nop_atomic_bit_test_and_p'.
> 
> It expands to ~38 KLOC in gimple-match.cc and ~350 KB in the compiled binary.
> 
> There has to be a better way than repeatedly emitting the match pattern for
> each member of {ATOMIC,SYNC}_FETCH_{AND,OR_XOR}_N :)

It's the way the matcher works - if you can think of a better way of
code-generating it within the constraints:
 - earlier patterns in match.pd should match first in case there are multiple
matches
 - matching time should ideally be O(size of the pattern) rather than O(size of
match.pd)

The 2nd constraint isn't currently fulfilled because of the first constraint
(or how that is implemented).  The 2nd constraint was the original design
goal to make frequent "re-folding" cheap.  The first constraint was implemented
to allow pattern ordering to disambiguate "overlapping" matches.

Writing a different code generation in genmatch should be possible, the
(lowered) AST is available.

  parent reply	other threads:[~2022-12-15 17:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 15:06 [Bug tree-optimization/108129] New: " amonakov at gcc dot gnu.org
2022-12-15 15:11 ` [Bug tree-optimization/108129] " marxin at gcc dot gnu.org
2022-12-15 17:24 ` pinskia at gcc dot gnu.org
2022-12-15 17:57 ` rguenth at gcc dot gnu.org [this message]
2023-03-28  4:34 ` crazylht at gmail dot com
2023-03-28 10:51 ` rguenth at gcc dot gnu.org
2023-03-28 11:31 ` cvs-commit at gcc dot gnu.org
2023-03-28 11:35 ` 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-108129-4-KK9Yn2aklA@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).