On Wed, Apr 26, 2017 at 2:27 PM, Richard Biener <richard.guent...@gmail.com> wrote: > On Tue, Apr 18, 2017 at 12:51 PM, Bin Cheng <bin.ch...@arm.com> wrote: >> Hi, >> This patch adds new loop constraint flags marking prologue, epilogue and >> versioned loops generated >> by vectorizer, unroller and versioning. These flags will be used in IVOPTs >> in order to differentiate >> possible hot innermost loop from others. I also plan to use them to avoid >> unnecessary cunroll on >> such loops. >> Is it OK? > > Hmm, it doesn't really match "constraints". > > I'd rather somehow track the "original" loop it was versioned / copied > from plus either a > "kind" (epilogue, prologue, version) or determine this from dominance > relationship between > the copy and the original loop. Or we generalize "constraints flags", saying to introduce general bit-wise flags for loop structure. Among these flags, one kind is constraint flags, the rest are general flags. We could also change boolean fields into such flags? I do have following patches relying on this to avoid complete unroll for prologue/epilogue loops. > > Thus, > > struct loop { > ... > /* If not zero the loop number this loop was copied from. */ > unsigned clone_of; In this case, we need to track between different loops, which looks like a burden. For example, we need to make sure loop number won't be reused. Even more complicated, considering in extreme case that the original loop could be removed.
> > would that help? With knowing loop relation we can also more > aggressively version > and eventually later collapse the two versions again if we can still > identify them and > they are still reasonably similar. > > Richard. > >> >> Thanks, >> bin >> 2017-04-11 Bin Cheng <bin.ch...@arm.com> >> >> * cfgloop.h (LOOP_C_PROLOG, LOOP_C_EPILOG, LOOP_C_VERSION): New. >> * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Set >> LOOP_C_EPILOG for unrolled epilogue loop. >> (vect_do_peeling): Set LOOP_C_PROLOG and LOOP_C_EPILOG for peeled >> loops. >> (vect_loop_versioning): Set LOOP_C_VERSION for versioned loop.