On 9/30/22 18:07, H.J. Lu wrote:
On Fri, Sep 30, 2022 at 4:06 PM Jeff Law <j...@ventanamicro.com> wrote:

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.

I got

[ ... ]

Pushed wrong version.  Sorry about that.  Fixed by attached patch which just moves the test down to its proper position.


Jeff


commit aa360fbf68b11e54017e8fa5b1bdb87ce7c19188
Author: Jeff Law <jeffreya...@gmail.com>
Date:   Fri Sep 30 20:46:04 2022 -0400

    Install correct patch version.
    
    gcc/
            * tree-ssa-dom.cc (record_edge_info): Install correct version of
            patch.

diff --git a/gcc/tree-ssa-dom.cc b/gcc/tree-ssa-dom.cc
index 8d8312ca350..e6b8dace5e9 100644
--- a/gcc/tree-ssa-dom.cc
+++ b/gcc/tree-ssa-dom.cc
@@ -684,11 +684,6 @@ record_edge_info (basic_block bb)
                       !gsi_end_p (gsi);
                       gsi_next (&gsi))
                    {
-                     /* If the other alternative is the same as the result,
-                        then this is a degenerate and can be ignored.  */
-                     if (dst == PHI_ARG_DEF (phi, !alternative))
-                       continue;
-
                      /* Now get the EDGE_INFO class so we can append
                         it to our list.  We want the successor edge
                         where the destination is not the source of
@@ -697,6 +692,11 @@ record_edge_info (basic_block bb)
                      tree src = PHI_ARG_DEF (phi, alternative);
                      tree dst = PHI_RESULT (phi);
 
+                     /* If the other alternative is the same as the result,
+                        then this is a degenerate and can be ignored.  */
+                     if (dst == PHI_ARG_DEF (phi, !alternative))
+                       continue;
+
                      if (EDGE_SUCC (bb, 0)->dest
                          != EDGE_PRED (bb, !alternative)->src)
                        edge_info = (class edge_info *)EDGE_SUCC (bb, 0)->aux;

Reply via email to