Hi, On Wed, Nov 24 2021, Thomas Schwinge wrote: > Hi! > > On 2021-07-30T15:58:36+0800, "Kewen.Lin" <li...@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;