From: Richard Biener <richard.guenther@gmail.com>
To: Andrew Pinski <apinski@marvell.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 2/2] PHIOPT: add folding/simplification detail to the dump
Date: Tue, 18 Apr 2023 08:24:38 +0200 [thread overview]
Message-ID: <CAFiYyc2Gc=YXcjvdNH4mEJ+fpX63CQTrPysSG-=BBWfHTfJ-Kg@mail.gmail.com> (raw)
In-Reply-To: <20230417221740.251864-2-apinski@marvell.com>
On Tue, Apr 18, 2023 at 12:18 AM Andrew Pinski via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> While debugging PHI-OPT with match-and-simplify,
> I found that adding more dumping to the debug dumps made
> it easier to understand what was going on rather than stepping in
> the debugger so this adds them. Note I used TDF_FOLDING rather
> than TDF_DETAILS as these debug messages can be chatty and
> only needed if you are debugging match and simplify
> with PHI-OPT and match and simplify uses TDF_FOLDING as
> its check.
>
> OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
OK.
> gcc/ChangeLog:
>
> * tree-ssa-phiopt.cc (gimple_simplify_phiopt): Dump
> the expression that is being tried when TDF_FOLDING
> is true.
> (phiopt_worker::match_simplify_replacement): Dump
> the sequence which was created by gimple_simplify_phiopt
> when TDF_FOLDING is true.
> ---
> gcc/tree-ssa-phiopt.cc | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
> index 4ddb4d5db90..616b5778602 100644
> --- a/gcc/tree-ssa-phiopt.cc
> +++ b/gcc/tree-ssa-phiopt.cc
> @@ -916,6 +916,18 @@ gimple_simplify_phiopt (bool early_p, tree type, gimple *comp_stmt,
> "a != 0". */
> tree cond = build2_loc (loc, comp_code, boolean_type_node,
> cmp0, cmp1);
> +
> + if (dump_file && (dump_flags & TDF_FOLDING))
> + {
> + fprintf (dump_file, "\nphiopt match-simplify trying:\n\t");
> + print_generic_expr (dump_file, cond);
> + fprintf (dump_file, " ? ");
> + print_generic_expr (dump_file, arg0);
> + fprintf (dump_file, " : ");
> + print_generic_expr (dump_file, arg1);
> + fprintf (dump_file, "\n");
> + }
> +
> gimple_match_op op (gimple_match_cond::UNCOND,
> COND_EXPR, type, cond, arg0, arg1);
>
> @@ -947,6 +959,18 @@ gimple_simplify_phiopt (bool early_p, tree type, gimple *comp_stmt,
> cond = build2_loc (loc,
> comp_code, boolean_type_node,
> cmp0, cmp1);
> +
> + if (dump_file && (dump_flags & TDF_FOLDING))
> + {
> + fprintf (dump_file, "\nphiopt match-simplify trying:\n\t");
> + print_generic_expr (dump_file, cond);
> + fprintf (dump_file, " ? ");
> + print_generic_expr (dump_file, arg1);
> + fprintf (dump_file, " : ");
> + print_generic_expr (dump_file, arg0);
> + fprintf (dump_file, "\n");
> + }
> +
> gimple_match_op op1 (gimple_match_cond::UNCOND,
> COND_EXPR, type, cond, arg1, arg0);
>
> @@ -1078,6 +1102,11 @@ match_simplify_replacement (basic_block cond_bb, basic_block middle_bb,
> if (name && TREE_CODE (name) == SSA_NAME)
> bitmap_set_bit (inserted_exprs, SSA_NAME_VERSION (name));
> }
> + if (dump_file && (dump_flags & TDF_FOLDING))
> + {
> + fprintf (dump_file, "Folded into the sequence:\n");
> + print_gimple_seq (dump_file, seq, 0, TDF_VOPS|TDF_MEMSYMS);
> + }
> gsi_insert_seq_before (&gsi, seq, GSI_CONTINUE_LINKING);
> }
>
> --
> 2.31.1
>
next prev parent reply other threads:[~2023-04-18 6:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-17 22:17 [PATCH 1/2] PHIOPT: small cleanup in match_simplify_replacement Andrew Pinski
2023-04-17 22:17 ` [PATCH 2/2] PHIOPT: add folding/simplification detail to the dump Andrew Pinski
2023-04-18 6:24 ` Richard Biener [this message]
2023-04-18 6:24 ` [PATCH 1/2] PHIOPT: small cleanup in match_simplify_replacement Richard Biener
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='CAFiYyc2Gc=YXcjvdNH4mEJ+fpX63CQTrPysSG-=BBWfHTfJ-Kg@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=apinski@marvell.com \
--cc=gcc-patches@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).