https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105562

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'm going to test this.

diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index d4d0aba880c..c9965549fce 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -2620,6 +2620,16 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void
*data_,
          return NULL;
        }

+      /* When the def is a CLOBBER we can optimistically disambiguate
+        against it since any overlap it would be undefined behavior.
+        Avoid this for obvious must aliases to save compile-time though.  */
+      if (gimple_clobber_p (def_stmt)
+         && !operand_equal_p (ao_ref_base (&lhs_ref), base, OEP_ADDRESS_OF))
+       {
+         *disambiguate_only = TR_DISAMBIGUATE;
+         return NULL;
+       }
+
       /* Besides valueizing the LHS we can also use access-path based
          disambiguation on the original non-valueized ref.  */
       if (!ref->ref

Reply via email to