]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sra: Clear grp_same_access_path of acesses created by total scalarization (PR118924)
authorMartin Jambor <mjambor@suse.cz>
Mon, 7 Apr 2025 11:32:10 +0000 (13:32 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Wed, 30 Apr 2025 20:41:06 +0000 (22:41 +0200)
During analysis of PR 118924 it was discussed that total scalarization
invents access paths (strings of COMPONENT_REFs and possibly even
ARRAY_REFs) which did not exist in the program before which can have
unintended effects on subsequent AA queries.  Although not doing that
does not mean that SRA cannot create such situations (see the bug for
more info), it has been agreed that not doing this is generally better.
This patch therfore makes SRA fall back on creating simple MEM_REFs when
accessing components of an aggregate corresponding to what a SRA
variable now represents.

gcc/ChangeLog:

2025-03-26  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/118924
* tree-sra.cc (create_total_scalarization_access): Set
grp_same_access_path flag to zero.

(cherry picked from commit 40445711b8af113ef423d8bcac1a7ce1c47f62d7)

gcc/tree-sra.cc

index 5a9eaf31b6e92f0182cdef566435b84179bc6529..91af2aef8b4c37ed79e94aa13ee15388475aa253 100644 (file)
@@ -3130,7 +3130,7 @@ create_total_scalarization_access (struct access *parent, HOST_WIDE_INT pos,
   access->grp_write = parent->grp_write;
   access->grp_total_scalarization = 1;
   access->grp_hint = 1;
-  access->grp_same_access_path = path_comparable_for_same_access (expr);
+  access->grp_same_access_path = 0;
   access->reverse = reverse_storage_order_for_component_p (expr);
 
   access->next_sibling = next_sibling;