https://gcc.gnu.org/g:63233dc13132d54602fa9cd7499340bac17de470

commit 63233dc13132d54602fa9cd7499340bac17de470
Author: Jeff Law <[email protected]>
Date:   Sun Feb 22 09:26:38 2026 -0700

    Allow refinement of an equivalence in the expression table.
    
    Always install the new equivalene.  This allows us to refine the
    equivalence as more information becomes available.  And since this
    uses the unwinding stack under the hood, the right things will
    just happen as we pop back up the dominator tree.

Diff:
---
 gcc/tree-ssa-scopedtables.cc | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gcc/tree-ssa-scopedtables.cc b/gcc/tree-ssa-scopedtables.cc
index 828f214c7cbe..95523b23478b 100644
--- a/gcc/tree-ssa-scopedtables.cc
+++ b/gcc/tree-ssa-scopedtables.cc
@@ -392,13 +392,13 @@ avail_exprs_stack::record_cond (cond_equivalence *p)
   expr_hash_elt **slot;
 
   slot = m_avail_exprs->find_slot_with_hash (element, element->hash (), 
INSERT);
-  if (*slot == NULL)
-    {
-      *slot = element;
-      record_expr (element, NULL, '1');
-    }
-  else
-    delete element;
+
+  /* We will always get back a valid slot in the hash table.  Go ahead and
+     record the new equivalence.  While it may be overwriting something older,
+     the belief is that the newer equivalence is more likely to be useful as
+     it was derived using more information/context.  */
+  record_expr (element, *slot, '1');
+  *slot = element;
 }
 
 /* Generate a hash value for a pair of expressions.  This can be used

Reply via email to