diff options
author | Martin Jambor <mjambor@suse.cz> | 2025-07-18 12:42:11 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2025-07-18 12:44:18 +0200 |
commit | 7375909e9d9e7de23acb4b1e0a965d8faf1943c4 (patch) | |
tree | d6b001f5c3ed36548ffec9a72b7bf3011cdbfadb /libstdc++-v3/testsuite/std | |
parent | 8bb7234a86f3432658f9fa29d7957d1d0c929832 (diff) | |
download | gcc-7375909e9d9e7de23acb4b1e0a965d8faf1943c4.zip gcc-7375909e9d9e7de23acb4b1e0a965d8faf1943c4.tar.gz gcc-7375909e9d9e7de23acb4b1e0a965d8faf1943c4.tar.bz2 |
tree-sra: Fix grp_covered flag computation when totally scalarizing (PR117423)
Testcase of PR 117423 shows a flaw in the fancy way we do "total
scalarization" in SRA now. We use the types encountered in the
function body and not in type declaration (allowing us to totally
scalarize when only one union field is ever used, since we effectively
"skip" the union then) and can accommodate pre-existing accesses that
happen to fall into padding.
In this case, we skipped the union (bypassing the
totally_scalarizable_type_p check) and the access falling into the
"padding" is an aggregate and so not a candidate for SRA but actually
containing data. Arguably total scalarization should just bail out
when it encounters this situation (but I decided not to depend on this
mainly because we'd need to detect all cases when we eventually cannot
scalarize, such as when a scalar access has children accesses) but the
actual bug is that the detection if all data in an aggregate is indeed
covered by replacements just assumes that is always the case if total
scalarization triggers which however may not be the case in cases like
this - and perhaps more.
This patch fixes the bug by just assuming that all padding is taken
care of when total scalarization triggered, not that every access was
actually scalarized.
gcc/ChangeLog:
2025-07-17 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/117423
* tree-sra.cc (analyze_access_subtree): Fix computation of grp_covered
flag.
gcc/testsuite/ChangeLog:
2025-07-17 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/117423
* gcc.dg/tree-ssa/pr117423.c: New test.
Diffstat (limited to 'libstdc++-v3/testsuite/std')
0 files changed, 0 insertions, 0 deletions