https://gcc.gnu.org/g:232f22615857cd83735770d82c7c0178e43bee19

commit r16-598-g232f22615857cd83735770d82c7c0178e43bee19
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Tue Dec 3 18:57:45 2024 -0800

    cfgexpand: Update cache during the original DFS walk
    
    This is a small optimization which can improve how many times are need 
through the update loop.
    It can reduce the number of times in the update loop by maybe 1 times.
    
    Bootstrapped and tested on x86_64-linux-gnu.
    
    gcc/ChangeLog:
    
            * cfgexpand.cc (vars_ssa_cache::operator()): Update the cache if 
the use is already
            has a cache.
    
    Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>

Diff:
---
 gcc/cfgexpand.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
index 0e76d340d262..277ef659f306 100644
--- a/gcc/cfgexpand.cc
+++ b/gcc/cfgexpand.cc
@@ -766,7 +766,12 @@ vars_ssa_cache::operator() (tree name)
 
       /* If the cache exists for the use, don't try to recreate it. */
       if (exists (use))
-       continue;
+       {
+         /* Update the cache here, this can reduce the number of
+            times through the update loop below.  */
+         update (old_name, use);
+         continue;
+       }
 
       /* Create the cache bitmap for the use and also
         so we don't go into an infinite loop for some phi nodes with loops.  */

Reply via email to