tree-optimization/93891 - improve same-store disambiguation
authorRichard Biener <rguenther@suse.de>
Tue, 25 Feb 2020 10:46:02 +0000 (11:46 +0100)
committerRichard Biener <rguenther@suse.de>
Mon, 4 May 2020 13:37:26 +0000 (15:37 +0200)
We need a reference to assess alignment, fall back to the original
reference tree if available.

2020-05-04  Richard Biener  <rguenther@suse.de>

PR tree-optimization/93891
* tree-ssa-sccvn.c (vn_reference_lookup_3): Fall back to
the original reference tree for assessing access alignment.

gcc/ChangeLog
gcc/tree-ssa-sccvn.c

index 61d5ce5ae1f1df673ebcdbce2dac03ebf71a45cf..88a32acefc0856489014d267bef0fbdc14360d58 100644 (file)
@@ -1,3 +1,9 @@
+2020-05-04  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/93891
+       * tree-ssa-sccvn.c (vn_reference_lookup_3): Fall back to
+       the original reference tree for assessing access alignment.
+
 2020-05-04  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/39612
index 238931d3f3e8c4f860c62f1b10fc4edf3732133f..8a4af91c54eee67c8c4aa23c1ccd5de314f4c667 100644 (file)
@@ -2527,7 +2527,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_,
         and return the found value.  */
       if (is_gimple_reg_type (TREE_TYPE (lhs))
          && types_compatible_p (TREE_TYPE (lhs), vr->type)
-         && ref->ref)
+         && (ref->ref || data->orig_ref.ref))
        {
          tree *saved_last_vuse_ptr = data->last_vuse_ptr;
          /* Do not update last_vuse_ptr in vn_reference_lookup_2.  */
@@ -2552,7 +2552,9 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_,
                     -fno-strict-aliasing.  So simply resort to alignment to
                     rule out overlaps.  Do this check last because it is
                     quite expensive compared to the hash-lookup above.  */
-                 && multiple_p (get_object_alignment (ref->ref), ref->size)
+                 && multiple_p (get_object_alignment
+                                  (ref->ref ? ref->ref : data->orig_ref.ref),
+                                ref->size)
                  && multiple_p (get_object_alignment (lhs), ref->size))
                return res;
            }