]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cfgexpand: Reverse the order of going through the update_cache_list queue.
authorAndrew Pinski <quic_apinski@quicinc.com>
Tue, 3 Dec 2024 23:57:42 +0000 (15:57 -0800)
committerAndrew Pinski <quic_apinski@quicinc.com>
Tue, 13 May 2025 15:27:31 +0000 (08:27 -0700)
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_apinski@quicinc.com>
gcc/cfgexpand.cc

index 2b27076658fdc31439845ec824084c86991e8cef..0e76d340d262944d5accb0316a39bd559dc030b6 100644 (file)
@@ -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);