This is a small optimization, the reversed order of the walk of update_cache_list queue. The queue is pushed in Pre-order/NLR, reversing the order will reduce how many times we need to go through the loop as we update the nodes which might have a link back to another one first.
Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * cfgexpand.cc (vars_ssa_cache::operator()): Reverse the order of the going through the update list. Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com> --- gcc/cfgexpand.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc index 2b27076658f..0e76d340d26 100644 --- a/gcc/cfgexpand.cc +++ b/gcc/cfgexpand.cc @@ -804,9 +804,11 @@ vars_ssa_cache::operator() (tree name) bool changed; do { changed = false; - for (auto &e : update_cache_list) + unsigned int i; + std::pair<tree,tree> *e; + FOR_EACH_VEC_ELT_REVERSE (update_cache_list, i, e) { - if (update (e.second, e.first)) + if (update (e->second, e->first)) changed = true; } } while (changed); -- 2.43.0