On Mon, 3 Jan 2022, Segher Boessenkool wrote: > Hi! > > On Mon, Jan 03, 2022 at 12:00:10PM +0100, Jakub Jelinek wrote: > > On Thu, Dec 30, 2021 at 04:08:25AM -0600, Segher Boessenkool wrote: > > > > The following simple patch makes sure we call can_get_prologue even > > > > after > > > > the last former iteration when vec is already empty and only break from > > > > the loop afterwards (and only if the updating of pro done because of > > > > !can_get_prologue didn't push anything into vec again). > > > > During the development of the above patch I've noticed that in many cases > > we call can_get_prologue often on the same pro again and again and again, > > we can have many basic blocks pushed into vec and if most of those don't > > require pro updates, i.e. > > basic_block bb = vec.pop (); > > if (!can_dup_for_shrink_wrapping (bb, pro, max_grow_size)) > > while (!dominated_by_p (CDI_DOMINATORS, bb, pro)) > > isn't true, then pro is can_get_prologue checked for each bb in the vec. > > > > The following simple patch just remembers which bb we've verified already > > and verifies again only when pro changes. Most of the patch is just > > reindentation. > > I'd like it better if the code structure was changed so you do not need > this workaround. That will probably result in much clearer code. > > But it does look correct :-) > > This should make things O(n) again here. Thanks for fixing this!
Btw, you can take that as approval. Richard.