From: Andrew Pinski Date: Tue, 3 Dec 2024 23:57:42 +0000 (-0800) Subject: cfgexpand: Reverse the order of going through the update_cache_list queue. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d380abf62dbf6c645fe46a3cea40e2febcd9ca8;p=thirdparty%2Fgcc.git 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 --- 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 *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);