public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/37166] New: variable is still committed to stack even though it is not aliased
@ 2008-08-19 19:20 pinskia at gcc dot gnu dot org
2008-08-19 19:32 ` [Bug tree-optimization/37166] " rguenth at gcc dot gnu dot org
2010-03-02 19:05 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-08-19 19:20 UTC (permalink / raw)
To: gcc-bugs
Testcase:
struct f { int a; };
int g(struct f *b, struct f *c)
{
struct f g;
if (!b) {
b = &g;
b->a = c->a + 1;
c->a = c->a + 1;
}
else if (!c) {
c = &g;
c->a = b->a + 1;
b->a = b->a + 1;
}
return c->a + b->a;
}
--- CUT ---
After some changes on the trunk, we get:
<bb 2>:
if (b == 0B)
goto <bb 3>;
else
goto <bb 4>;
<bb 3>:
g.a = [plus_expr] c->a + 1;
prephitmp.13 = c->a + 1;
c->a = prephitmp.13;
prephitmp.25 = g.a;
goto <bb 7>;
<bb 4>:
if (c == 0B)
goto <bb 6>;
else
goto <bb 5>;
<bb 5>:
prephitmp.13 = c->a;
prephitmp.25 = b->a;
goto <bb 7>;
<bb 6>:
g.a = [plus_expr] b->a + 1;
prephitmp.25 = b->a + 1;
b->a = prephitmp.25;
prephitmp.13 = g.a;
<bb 7>:
return prephitmp.25 + prephitmp.13;
--- CUT ---
Notice how g.a is still referenced. This comes from
# b_1 = PHI <&g(3), b_3(D)(7), b_3(D)(5)>
Being in the IR after PRE even though b_1 is no longer referenced.
So for 32bit PPC we get a stack adjustment:
stwu %r1,-32(%r1)
..
addi %r1,%r1,32
Even though there is no need for this adjustment as nothing touches the stack
but the variable g is still being marked with TREE_ADDRESSABLE as evident by:
Partition 0: size 4 align 4
g, offset 0
in the .expand dump.
--
Summary: variable is still committed to stack even though it is
not aliased
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37166
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-03-02 19:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-19 19:20 [Bug tree-optimization/37166] New: variable is still committed to stack even though it is not aliased pinskia at gcc dot gnu dot org
2008-08-19 19:32 ` [Bug tree-optimization/37166] " rguenth at gcc dot gnu dot org
2010-03-02 19:05 ` pinskia at gcc dot gnu dot 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).