]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/119044 - predcom fails to preserve alias info
authorRichard Biener <rguenther@suse.de>
Thu, 27 Feb 2025 13:51:44 +0000 (14:51 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 28 Apr 2025 13:12:44 +0000 (15:12 +0200)
Predictive commoning fails to preserve alias info for the refs it
creates.  The following adds this to see whether it fixes the
observed regression in 436.cactusADM after r15-7665.

PR tree-optimization/119044
* tree-predcom.cc (ref_at_iteration): Copy alias info
from the original ref.

gcc/tree-predcom.cc

index d45aa3857b9fa752fa8809778b8da336a8c82dec..509d112a0a06fdfd440e128eeee3b6d36b894f1c 100644 (file)
@@ -234,6 +234,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-affine.h"
 #include "builtins.h"
 #include "opts.h"
+#include "tree-ssa-address.h"
 
 /* The maximum number of iterations between the considered memory
    references.  */
@@ -1824,6 +1825,7 @@ ref_at_iteration (data_reference_p dr, int iter,
   tree type = build_aligned_type (TREE_TYPE (ref),
                                  get_object_alignment (ref));
   ref = build2 (MEM_REF, type, addr, alias_ptr);
+  copy_ref_info (ref, DR_REF (dr));
   if (ref_type)
     ref = build3 (ref_code, ref_type, ref, ref_op1, ref_op2);
   return ref;