https://gcc.gnu.org/g:2d380abf62dbf6c645fe46a3cea40e2febcd9ca8
commit r16-597-g2d380abf62dbf6c645fe46a3cea40e2febcd9ca8 Author: Andrew Pinski <quic_apin...@quicinc.com> Date: Tue Dec 3 15:57:42 2024 -0800 cfgexpand: Reverse the order of going through the update_cache_list queue. 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> Diff: --- gcc/cfgexpand.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc index 2b27076658fd..0e76d340d262 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);