]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-sra: Avoid total SRA if there are incompat. aggregate accesses (PR119085)
authorMartin Jambor <mjambor@suse.cz>
Wed, 23 Jul 2025 09:22:33 +0000 (11:22 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Wed, 23 Jul 2025 09:23:16 +0000 (11:23 +0200)
commit171fcc80ede596442712e559c4fc787aa4636694
treefb3ddbf95667197e7fc29e79de6edd41b8506030
parentab5a89c0b4f1ead202dee072e16690607b810111
tree-sra: Avoid total SRA if there are incompat. aggregate accesses  (PR119085)

We currently use the types encountered in the function body and not in
type declaration to perform total scalarization.  Bug PR 119085
uncovered that we miss a check that when the same data is accessed
with aggregate types that those are actually compatible.  Without it,
we can base total scalarization on a type that does not "cover" all
live data in a different part of the function.  This patch adds the
check.

gcc/ChangeLog:

2025-07-21  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/119085
* tree-sra.cc (sort_and_splice_var_accesses): Prevent total
scalarization if two incompatible aggregates access the same place.

gcc/testsuite/ChangeLog:

2025-07-21  Martin Jambor  <mjambor@suse.cz>

PR tree-optimization/119085
* gcc.dg/tree-ssa/pr119085.c: New test.
gcc/testsuite/gcc.dg/tree-ssa/pr119085.c [new file with mode: 0644]
gcc/tree-sra.cc