public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Jambor <mjambor@suse.cz>
To: Thomas Schwinge <thomas@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: Reduce scope of a few 'class loop *loop' variables (was: [PATCH v4] Use range-based for loops for traversing loops)
Date: Wed, 24 Nov 2021 17:58:21 +0100	[thread overview]
Message-ID: <ri6bl29ij82.fsf@suse.cz> (raw)
In-Reply-To: <874k81y6ln.fsf@euler.schwinge.homeip.net>

Hi,

On Wed, Nov 24 2021, Thomas Schwinge wrote:
> Hi!
>
> On 2021-07-30T15:58:36+0800, "Kewen.Lin" <linkw@linux.ibm.com> wrote:
>> on 2021/7/30 下午3:18, Thomas Schwinge wrote:
>>> Curious why in some instances we're not removing the 'class loop *loop'
>>> declaration, I had a look, and this may suggest some further clean-up?
>>
>> [...] I like your nice proposed further clean-up,
>> thanks for doing that!
>
> Ping for my patch to "Reduce scope of a few 'class loop *loop' variables",
> see attached.
>

[...]
>

> Further clean-up after commit e41ba804ba5f5ca433e09238d561b1b4c8b10985
> "Use range-based for loops for traversing loops".  No functional change.
>
> 	gcc/
> 	* cfgloop.c (verify_loop_structure): Reduce scope of
> 	'class loop *loop' variable.
> 	* ipa-fnsummary.c (analyze_function_body): Likewise.

FWIW, the ipa-fnsummary.c hunk is OK (and better-that-expected clean-up
too, because it avoids the loop variable being hidden by another with
the same name in an earlier loop).

Thanks,

Martin


> 	* loop-init.c (fix_loop_structure): Likewise.
> 	* loop-invariant.c (calculate_loop_reg_pressure): Likewise.
> 	* predict.c (predict_loops): Likewise.
> 	* tree-loop-distribution.c (loop_distribution::execute): Likewise.
> 	* tree-vectorizer.c (pass_vectorize::execute): Likewise.

[...]

> diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
> index 7e9201a554a..cb13d2e4b3c 100644
> --- a/gcc/ipa-fnsummary.c
> +++ b/gcc/ipa-fnsummary.c
> @@ -2934,7 +2934,6 @@ analyze_function_body (struct cgraph_node *node, bool early)
>    if (nonconstant_names.exists () && !early)
>      {
>        ipa_fn_summary *s = ipa_fn_summaries->get (node);
> -      class loop *loop;
>        unsigned max_loop_predicates = opt_for_fn (node->decl,
>  						 param_ipa_max_loop_predicates);
>  
> @@ -2978,7 +2977,7 @@ analyze_function_body (struct cgraph_node *node, bool early)
>        /* To avoid quadratic behavior we analyze stride predicates only
>           with respect to the containing loop.  Thus we simply iterate
>  	 over all defs in the outermost loop body.  */
> -      for (loop = loops_for_fn (cfun)->tree_root->inner;
> +      for (class loop *loop = loops_for_fn (cfun)->tree_root->inner;
>  	   loop != NULL; loop = loop->next)
>  	{
>  	  ipa_predicate loop_stride = true;

  reply	other threads:[~2021-11-24 16:58 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19  6:20 [RFC/PATCH] Use range-based for loops for traversing loops Kewen.Lin
2021-07-19  6:26 ` Andrew Pinski
2021-07-20  8:56   ` Kewen.Lin
2021-07-19 14:08 ` Jonathan Wakely
2021-07-20  8:56   ` Kewen.Lin
2021-07-19 14:34 ` Richard Biener
2021-07-20  8:57   ` Kewen.Lin
2021-07-19 15:59 ` Martin Sebor
2021-07-20  8:58   ` Kewen.Lin
2021-07-20  9:49     ` Jonathan Wakely
2021-07-20  9:50       ` Jonathan Wakely
2021-07-20 14:42       ` Kewen.Lin
2021-07-20 14:36 ` [PATCH v2] " Kewen.Lin
2021-07-22 12:56   ` Richard Biener
2021-07-22 12:56     ` Richard Biener
2021-07-23  8:41     ` [PATCH] Make loops_list support an optional loop_p root Kewen.Lin
2021-07-23 16:26       ` Martin Sebor
2021-07-27  2:25         ` Kewen.Lin
2021-07-29  8:01       ` Richard Biener
2021-07-30  5:20         ` [PATCH v2] " Kewen.Lin
2021-08-03 12:08           ` Richard Biener
2021-08-04  2:36             ` [PATCH v3] " Kewen.Lin
2021-08-04 10:01               ` Richard Biener
2021-08-04 10:47                 ` Kewen.Lin
2021-08-04 12:04                   ` Richard Biener
2021-08-05  8:50                     ` Kewen.Lin
2021-07-23  8:35   ` [PATCH v3] Use range-based for loops for traversing loops Kewen.Lin
2021-07-23 16:10     ` Martin Sebor
2021-07-27  2:10       ` [PATCH v4] " Kewen.Lin
2021-07-29  7:48         ` Richard Biener
2021-07-30  7:18         ` Thomas Schwinge
2021-07-30  7:58           ` Kewen.Lin
2021-11-24 14:24             ` Reduce scope of a few 'class loop *loop' variables (was: [PATCH v4] Use range-based for loops for traversing loops) Thomas Schwinge
2021-11-24 16:58               ` Martin Jambor [this message]
2021-11-24 19:44               ` Jeff Law

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=ri6bl29ij82.fsf@suse.cz \
    --to=mjambor@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=thomas@codesourcery.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).