On Wed, Aug 27, 2014 at 10:10 AM, Bin Cheng <bin.ch...@arm.com> wrote: > Hi, > As I analyzed in bug pr62178, current candidate selecting algorithm can't > find out the optimal solution in some scenarios. I am trying to improve it > but before that, I need to clean up the interface of iv_ca_add_use and the > calls to it. The two calls to the function are controlled by a boolean > argument, and the second call is always fired if the first one doesn't give > any result. This patch encapsulates logic of the two calls into function > iv_ca_add_use and cleanups the interface. > Another change is remove the check in below code. > > gcc_assert (ivs->upto >= use->id); > > if (ivs->upto == use->id) > { > ivs->upto++; > ivs->bad_uses++; > } > > It can be proved in an inductive approach that ivs->up_to always equals to > use->id at the position. > > This patch does not change code logic at all, anyway, it passes bootstrap > and regtest on x86_64/x86. So is it OK?
Ok (I suppose you checked that it really generates the same code on a set of files?) Thanks, Richard. > Thanks, > bin > > 2014-08-27 Bin Cheng <bin.ch...@arm.com> > > * tree-ssa-loop-ivopts.c (iv_ca_add_use): Delete parameter > important_candidates. Consider all important candidates if > IVS doesn't give any result. Remove check on ivs->upto. > (try_add_cand_for): Call iv_ca_add_use only once.