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? Thanks, bin 2017-04-11 Bin Cheng * 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.