[Bug tree-optimization/67283] GCC regression over inlining of returned structures
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Aug 20 11:55:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67283
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-08-20
CC| |jamborm at gcc dot gnu.org
Component|c |tree-optimization
Ever confirmed|0 |1
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
;; Function demo_3 (demo_3, funcdef_no=4, decl_uid=1849, cgraph_uid=4,
symbol_order=4)
Candidate (1904): foo
Candidate (1901): foo
Candidate (1898): foo
Candidate (1870): D.1870
Candidate (1869): D.1869
Candidate (1868): D.1868
! Disqualifying D.1868 - No scalar replacements to be created.
Created a replacement for D.1869 offset: 0, size: 32: SR.30
...
demo_3 ()
{
int foo;
int foo;
int SR.30;
struct foo foo;
struct foo foo;
struct foo foo;
struct foo D.1870;
struct foo D.1869;
struct foo D.1868;
<bb 2>:
foo = {};
D.1868 = foo;
foo ={v} {CLOBBER};
foo = D.1868;
foo_12 = MEM[(struct foo *)&D.1868];
foo_11 = 1;
MEM[(struct foo *)&foo] = foo_11;
D.1869 = foo;
SR.30_13 = foo_11;
SR.30_14 = 1;
MEM[(struct foo *)&D.1869] = SR.30_14;
foo = D.1869;
foo_16 = SR.30_14;
foo_17 = 3;
MEM[(struct foo *)&foo] = foo_17;
D.1870 = foo;
some_unknown_function (D.1870);
return;
}
so it does _some_ SRA but not all required SRA for some reason.
Starts (IMHO) even with new_foo itself during early opts:
Candidate (1835): foo
! Disqualifying foo - No scalar replacements to be created.
new_foo ()
{
struct foo foo;
<bb 2>:
foo = {};
<retval> = foo;
foo ={v} {CLOBBER};
return <retval>;
}
where for some reason we fail to scalarize foo. Similar add_flag
which ends up with
add_flag (struct foo foo, int flag)
{
int foo$flags;
int _2;
int _4;
<bb 2>:
foo$flags_5 = MEM[(struct foo *)&foo];
_2 = foo$flags_5;
_4 = _2 | flag_3(D);
foo$flags_7 = _4;
MEM[(struct foo *)&foo] = foo$flags_7;
<retval> = foo;
return <retval>;
}
hmm, but here we are returning a parameter - we can't scalarize the parameter
and we can't scalarize the return. But we still want to avoid storing
into 'foo' and store into retval directly.
;; Function demo_1 (demo_1, funcdef_no=2, decl_uid=1843, cgraph_uid=2,
symbol_order=2)
Candidate (1890): foo
Candidate (1858): D.1858
! Disqualifying D.1858 - No scalar replacements to be created.
! Disqualifying foo - No scalar replacements to be created.
demo_1 ()
{
struct foo foo;
struct foo D.1858;
<bb 2>:
foo = {};
D.1858 = foo;
foo ={v} {CLOBBER};
some_unknown_function (D.1858);
return;
so no total scalarization for foo? Maybe SRA is confused by the CLOBBER?
More information about the Gcc-bugs
mailing list