https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103860
--- Comment #7 from Segher Boessenkool <segher at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #6) > Created attachment 52089 [details] > gcc12-pr103860.patch > > Not sure I understand what you'd like to see. Exactly what you did :-) Well, I didn't see you could fold it all up like that, wow. > But, thinking more about it, we can easily avoid all the code duplication by > moving the vec.is_empty () test out of the while loop condition, right > before we pop from the stack. That way this can_get_prologue check is done > on pro not just before we pop something from the stack, but also after the > last iteration > when there is nothing further on the stack. Yup. > If we wanted to avoid calling can_get_prologue that often (if pro doesn't > change we call it again and again already before my patch), we could also > add a var to hold the last pro we've successfully checked and only do this > checking if we get a new pro. How can pro not change? It is important that can_get_prologue is called at most once for every block, so that this is O(n) for every function (in number of edges in this case). All of this is linear, I'd like to keep it that way!