On Wed, Apr 26, 2017 at 2:22 PM, Richard Biener <richard.guent...@gmail.com> wrote: > On Tue, Apr 18, 2017 at 12:50 PM, Bin Cheng <bin.ch...@arm.com> wrote: >> Hi, >> IVOPTs still have difficulty for outer loop (especially for large loop >> nest), and tend to select too many candidates. >> It's generally bad because of unavoidable register spilling. In this case, >> we probably want to compute iv_uses with >> small number of bivs. Though this results in more computation inside of >> loop, it could improve spilling. >> This patch adds new parameter bound on number of selected candidates, it >> simply gives up if too many candidates are >> selected. So far it works loop by loop, I am not sure if we want to by pass >> whole loop nest once this bound is hit. >> Is it OK? > > Hmm, I don't like such kind of caps. We should simply add less > candidates in such cases? Like cap this > in find_optimal_iv_set instead, always using the original set of > candidates just not trying harder? > > IIRC much of the problem is because the inner loop has been processed > already and thus there may appear > to be a very large number of "original" IVs already? I may misremeber though. Only loop header phis contribute to BIVs, IVs created by inner loop is GIVs. Yes, inner loop sometime creates too many non-linear type GIVs for outer loop, which again causes too many candidates selected. I haven't found a good fix yet. The coming register pressure estimate should be helpful. Note when register pressure is within range, we do want inner loop to create as many GIVs for outer loop as possible.
> > I think this patch doesn't really belong in the series? Okay, I will create a standalone patch if necessary. Thanks, bin > > Richard. > >> >> Thanks, >> bin >> 2017-04-11 Bin Cheng <bin.ch...@arm.com> >> >> * doc/invoke.texi (iv-max-selected-candidates): New. >> * params.def (PARAM_IV_MAX_SELECTED_CANDIDATES): New. >> * tree-ssa-loop-ivopts.c (MAX_SELECTED_CANDIDATES): New. >> (tree_ssa_iv_optimize_loop): Skip if too many cands are selected.