public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113419] New: SRA should replace some aggregate copies by load/store
@ 2024-01-16 9:43 rguenth at gcc dot gnu.org
2024-01-16 9:45 ` [Bug tree-optimization/113419] " rguenth at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-16 9:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113419
Bug ID: 113419
Summary: SRA should replace some aggregate copies by load/store
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
Target Milestone: ---
For example gcc.dg/tree-ssa/pr94969.c has
int a = 0, b = 0, c = 0;
struct S {
signed m : 7;
signed e : 2;
};
struct S f[2] = {{0, 0}, {0, 0}};
struct S g = {0, 0};
void __attribute__((noinline))
k()
{
for (; c <= 1; c++) {
f[b] = g;
f[b].e ^= 1;
}
}
the aggregate copy f[b] = g isn't touched by SRA because it's global
variables. For locals we'd end up with sth like
<unnamed-signed:2> g$e;
<unnamed-signed:7> g$m;
struct S g;
struct S a[2];
<bb 2> :
g$m_7 = 0;
g$e_8 = 0;
MEM[(struct S *)&a + 4B].m = g$m_7;
MEM[(struct S *)&a + 4B].e = g$e_8;
so bit-precision integers. That might be good, esp. if there's field
uses around.
When the global variable variant is expaneded on RTL we see a simple
SImode load and a SImode store. That means we should ideally treat
aggregate copies like memcpy (&dest, &src, sizeof (dest)) and then
fold it that way.
But we should let SRA have a chance at decomposing first so this
shouldn't be done as part of general folding but instead by late SRA
for aggregate copies it didn't touch. For the gcc.dg/tree-ssa/pr94969.c
testcase this then allows GIMPLE invariant motion to hoist the load
from g, otherwise we rely on RTL PRE for this which is prone to PR113395.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/113419] SRA should replace some aggregate copies by load/store
2024-01-16 9:43 [Bug tree-optimization/113419] New: SRA should replace some aggregate copies by load/store rguenth at gcc dot gnu.org
@ 2024-01-16 9:45 ` rguenth at gcc dot gnu.org
2024-01-17 1:23 ` pinskia at gcc dot gnu.org
2024-01-17 1:26 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-16 9:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113419
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
Ever confirmed|0 |1
Last reconfirmed| |2024-01-16
Status|UNCONFIRMED |ASSIGNED
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'll take this for next stage1, factoring out sth from
gimple_fold_builtin_memory_op
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/113419] SRA should replace some aggregate copies by load/store
2024-01-16 9:43 [Bug tree-optimization/113419] New: SRA should replace some aggregate copies by load/store rguenth at gcc dot gnu.org
2024-01-16 9:45 ` [Bug tree-optimization/113419] " rguenth at gcc dot gnu.org
@ 2024-01-17 1:23 ` pinskia at gcc dot gnu.org
2024-01-17 1:26 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-17 1:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113419
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Severity|normal |enhancement
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect there might be a few duplicates floating around too.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/113419] SRA should replace some aggregate copies by load/store
2024-01-16 9:43 [Bug tree-optimization/113419] New: SRA should replace some aggregate copies by load/store rguenth at gcc dot gnu.org
2024-01-16 9:45 ` [Bug tree-optimization/113419] " rguenth at gcc dot gnu.org
2024-01-17 1:23 ` pinskia at gcc dot gnu.org
@ 2024-01-17 1:26 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-17 1:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113419
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=99728
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
PR 99728 for one, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99728#c17 .
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-17 1:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 9:43 [Bug tree-optimization/113419] New: SRA should replace some aggregate copies by load/store rguenth at gcc dot gnu.org
2024-01-16 9:45 ` [Bug tree-optimization/113419] " rguenth at gcc dot gnu.org
2024-01-17 1:23 ` pinskia at gcc dot gnu.org
2024-01-17 1:26 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).