From: Jason Merrill <jason@redhat.com>
To: Eugene Rozenfeld <Eugene.Rozenfeld@microsoft.com>,
"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Set discriminators for call stmts on the same line within the same basic block
Date: Tue, 4 Oct 2022 18:21:12 -0400 [thread overview]
Message-ID: <febbb3bd-d5ff-eb6a-d49f-fd24ae961d8f@redhat.com> (raw)
In-Reply-To: <CY5PR21MB3542EFA4C26432C5D92ADA04915B9@CY5PR21MB3542.namprd21.prod.outlook.com>
On 10/3/22 02:08, Eugene Rozenfeld wrote:
> This change is based on commit 1e6c4a7a8fb8e20545bb9f9032d3854f3f794c18
> by Dehao Chen in vendors/google/heads/gcc-4_8.
>
> Tested on x86_64-pc-linux-gnu.
Brief rationale for the change?
> gcc/ChangeLog:
> * tree-cfg.cc (assign_discriminators): Set discriminators for call stmts
> on the same line within the same basic block.
> ---
> gcc/tree-cfg.cc | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
> index ade66c54499..8e2a3a5f6c6 100644
> --- a/gcc/tree-cfg.cc
> +++ b/gcc/tree-cfg.cc
> @@ -1203,8 +1203,39 @@ assign_discriminators (void)
> {
> edge e;
> edge_iterator ei;
> + gimple_stmt_iterator gsi;
> gimple *last = last_stmt (bb);
> location_t locus = last ? gimple_location (last) : UNKNOWN_LOCATION;
> + location_t curr_locus = UNKNOWN_LOCATION;
> + int curr_discr = 0;
> +
> + /* Traverse the basic block, if two function calls within a basic block
> + are mapped to the same line, assign a new discriminator because a call
> + stmt could be a split point of a basic block. */
> + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
> + {
> + gimple *stmt = gsi_stmt (gsi);
> + expanded_location curr_locus_e;
> + if (curr_locus == UNKNOWN_LOCATION)
> + {
> + curr_locus = gimple_location (stmt);
> + curr_locus_e = expand_location (curr_locus);
> + }
> + else if (!same_line_p (curr_locus, &curr_locus_e, gimple_location (stmt)))
> + {
> + curr_locus = gimple_location (stmt);
> + curr_locus_e = expand_location (curr_locus);
> + curr_discr = 0;
> + }
> + else if (curr_discr != 0)
> + {
> + gimple_set_location (stmt, location_with_discriminator (
> + gimple_location (stmt), curr_discr));
This indentation is wonky, with an open paren at the end of the line;
I'd suggest reformatting to
> location_t dloc = (location_with_discriminator > (gimple_location (stmt),
curr_discr));> gimple_set_location (stmt, dloc);
Jason
next prev parent reply other threads:[~2022-10-04 22:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-03 6:08 Eugene Rozenfeld
2022-10-04 22:21 ` Jason Merrill [this message]
2022-10-07 3:50 ` Eugene Rozenfeld
2022-10-07 4:08 ` Jason Merrill
2022-10-11 0:54 David Edelsohn
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=febbb3bd-d5ff-eb6a-d49f-fd24ae961d8f@redhat.com \
--to=jason@redhat.com \
--cc=Eugene.Rozenfeld@microsoft.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).