on 2021/7/19 下午10:34, Richard Biener wrote: > On Mon, Jul 19, 2021 at 8:20 AM Kewen.Lin <li...@linux.ibm.com> wrote: >> >> Hi, >> >> This patch follows Martin's suggestion here[1], to support >> range-based for loops for traversing loops, analogously to >> the patch for vec[2]. >> >> Bootstrapped and regtested on powerpc64le-linux-gnu P9, >> x86_64-redhat-linux and aarch64-linux-gnu, also >> bootstrapped on ppc64le P9 with bootstrap-O3 config. >> >> Any comments are appreciated. > > Since you are touching all FOR_EACH_LOOP please > make implicit 'cfun' uses explicit. I'm not sure ALL_LOOPS > should scream, I think all_loops (function *, flags) would be > nicer. > > Note I'm anticipating iteration over a subset of the loop tree > which would ask for specifying the 'root' of the loop tree to > iterate over so it could be > > loops_list (class loop *root, unsigned flags) > > and the "all" cases use loops_list (loops_for_fn (cfun), flags) then. > Providing an overload with struct function is of course OK. >
Thanks for the comments, Richi. Will update them in V2. I noticed the current loop_iterator requires a struct loops* for LI_ONLY_INNERMOST, if you don't mind, I will use loops_list (class loops *loops, unsigned flags) instead to make LI_ONLY_INNERMOST happy. Your mentioned root can be just the tree_root of the input loops. BR, Kewen