[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    [committed] Minor cleanup/prep in DOM
From:       Jeff Law <jlaw () ventanamicro ! com>
Date:       2022-09-30 23:05:47
Message-ID: 44815a60-2cd4-9408-64a9-d718163bca71 () ventanamicro ! com
[Download RAW message or body]

It's a bit weird that free_dom_edge_info leaves a dangling pointer in 
e->aux.  Not sure what I was thinking.


There's two callers.  One wipes e->aux immediately after the call, the 
other attaches a newly created object immediately after the call.  So we 
can wipe e->aux within the call and simplify one of the two call sites.

This is preparatory work for a minor optimization where we want to 
detect another class of edge equivalences in DOM (until something better 
is available) and either attach them an existing edge_info structure or 
create a new one if one doesn't currently exist for a given edge.

Bootstrapped and regression tested on x86_64.  Installing on the trunk.


Jeff


["P" (text/plain)]

commit fbd95c027edcc169cc3b40806375fbabc08500e0
Author: Jeff Law <jeffreyalaw@gmail.com>
Date:   Fri Sep 30 18:59:24 2022 -0400

    Minor cleanup/prep in DOM
    
    It's a bit weird that free_dom_edge_info leaves a dangling pointer in e->aux.
    Not sure what I was thinking.
    
    There's two callers.  One wipes e->aux immediately after the call, the other
    attaches a newly created object immediately after the call.  So we can wipe
    e->aux within the call and simplify one of the two call sites.
    
    This is preparatory work for a minor optimization where we want to detect
    another class of edge equivalences in DOM (until something better is available)
    and either attach them an existing edge_info structure or create a new one if
    one doesn't currently exist for a given edge.
    
    gcc/
            * tree-ssa-dom.cc (free_dom_edge_info): Clear e->aux too.
            (free_all_edge_infos): Do not clear e->aux here.

diff --git a/gcc/tree-ssa-dom.cc b/gcc/tree-ssa-dom.cc
index 84bef798f52..fa43dbe6c44 100644
--- a/gcc/tree-ssa-dom.cc
+++ b/gcc/tree-ssa-dom.cc
@@ -393,7 +393,8 @@ edge_info::record_simple_equiv (tree lhs, tree rhs)
     simple_equivalences.safe_push (equiv_pair (lhs, rhs));
 }
 
-/* Free the edge_info data attached to E, if it exists.  */
+/* Free the edge_info data attached to E, if it exists and
+   clear e->aux.  */
 
 void
 free_dom_edge_info (edge e)
@@ -402,6 +403,7 @@ free_dom_edge_info (edge e)
 
   if (edge_info)
     delete edge_info;
+  e->aux = NULL;
 }
 
 /* Free all EDGE_INFO structures associated with edges in the CFG.
@@ -420,10 +422,7 @@ free_all_edge_infos (void)
   FOR_EACH_BB_FN (bb, cfun)
     {
       FOR_EACH_EDGE (e, ei, bb->preds)
-        {
-	  free_dom_edge_info (e);
-	  e->aux = NULL;
-	}
+	free_dom_edge_info (e);
     }
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic