On Mon, 22 Jul 2019, Segher Boessenkool wrote: > On Mon, Jul 22, 2019 at 09:18:10AM +0200, Richard Biener wrote: > > On Mon, 22 Jul 2019, Segher Boessenkool wrote: > > > > > Hi! > > > > > > (Maybe I am missing half of the discussion -- sorry if so). > > > > > > I think we should have a new iv for just the doloop (which can have the > > > same starting value and step and type as another iv). > > > > > > Has this been considered? > > > > I was also suggesting this (maybe with too many words ;)). If > > it's a doloop target add such IV (candidate!) which has zero > > use-cost for the increment and compare but a (target configurable) > > penalty for other uses. Invasiveness of this approach is probably > > that you need to distinguish this candidate by making it a new > > kind (or maybe we can just have a specia candidate number...). > > Or just set some (boolean) flag in the candidate. > > I think it should simply not be allowed for any use except the doloop > uses at all? You can have multiple ivs for the same loop just fine, > right? And costs will make everything work out, if the costs are set > correctly?
Sure. Upthread it was mentioned some targets can easily use the counter IV in other IV uses so it's really a matter of costs. That is, IVOPTs generated "fake" RTL should, for doloop IVs, choose an appropriate register so the target can do costing. Richard.