public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Roger Sayle <roger@nextmovesoftware.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Generate an if instead of a switch with one case in genmatch.
Date: Wed, 16 Mar 2022 13:53:40 +0100	[thread overview]
Message-ID: <CAFiYyc17RvahCJrG0XVnb=ukjs-M1dEaH3t=Dzr45=ZxDRX9=Q@mail.gmail.com> (raw)
In-Reply-To: <001001d83931$3defb510$b9cf1f30$@nextmovesoftware.com>

On Wed, Mar 16, 2022 at 1:28 PM Roger Sayle <roger@nextmovesoftware.com> wrote:
>
>
> This patch is the first of two changes to genmatch that don't affect
> the executable code, but reduce the amount of debugging information
> generated in stage3 of a build, but adhering more closely to GNU style
> guidelines.
>
> This patch avoids generating a switch with a single case statement,
> instead preferring to use an "if (TREE_CODE (...) == SSA_NAME)" idiom.
> These should compile to the same instructions, but the switch requires
> more lines, especially when a debugger may set a break point on the
> switch, the case, or the (obligatory) final "default:;".  This reduces
> the size of gimple-match.o by 53K on x86_64-pc-linux-gnu.
>
> This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
> and make -k check with no new failures.  Ok for mainline?

Hmm, this makes the complicated code emission in gen_kids_1 even more
complicated for a questionable gain which I'd rather not do, debuginfo
savings or not ...

Richard.

>
> 2022-03-16  Roger Sayle  <roger@nextmovesoftware.com>
>
> gcc/ChangeLog
>         * gcc/genmatch.cc (dt_node::gen_kids_1): Introduce use_switch
>         logic that prefers to generate an if statement rather than a
>         switch containing a single case (and a default).
>
>
> Thanks in advance,
> Roger
> --
>

      reply	other threads:[~2022-03-16 12:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16 12:27 Roger Sayle
2022-03-16 12:53 ` Richard Biener [this message]

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='CAFiYyc17RvahCJrG0XVnb=ukjs-M1dEaH3t=Dzr45=ZxDRX9=Q@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=roger@nextmovesoftware.com \
    /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).