[Bug ipa/102452] Structs with flexible array members are not optimized on stack
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Sep 23 06:57:23 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102452
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
get_three after einline w/o USE_FLEX_ARR defined (this is changing the type to
int):
<bb 2> :
_5 = test_2(D)->is_a;
if (_5 != 0)
goto <bb 3>; [50.00%]
else
goto <bb 4>; [50.00%]
<bb 3> :
D.3292 = *test_2(D);
goto <bb 5>; [100.00%]
<bb 4> :
_6 = test_2(D)->as.b.one;
_7 = (long int) _6;
_8 = test_2(D)->as.b.two;
_9 = (long int) _8;
_10 = test_2(D)->as.b.three;
_11 = (long int) _10;
D.3292.as.a.one = _7;
D.3292.as.a.two = _9;
D.3292.as.a.three = _11;
<bb 5> :
_4 = D.3292.as.a.three;
return _4;
With USE_FLEX_ARR defined to 1:
<bb 2> :
_5 = test_2(D)->is_a;
if (_5 != 0)
goto <bb 3>; [50.00%]
else
goto <bb 4>; [50.00%]
<bb 3> :
D.3293 = *test_2(D);
goto <bb 5>; [100.00%]
<bb 4> :
_6 = test_2(D)->as.b.one;
_7 = (long int) _6;
ret.as.a.one = _7;
_8 = test_2(D)->as.b.two;
_9 = (long int) _8;
ret.as.a.two = _9;
_10 = test_2(D)->as.b.three;
_11 = (long int) _10;
ret.as.a.three = _11;
D.3293 = ret;
ret ={v} {CLOBBER};
<bb 5> :
_4 = D.3293.as.a.three;
return _4;
as far as I can tell the IR is the same before that,
even RSO:
D.3293 = make_test_a (test_2(D)); [return slot optimization]
But it looks in the case of the flex array case, RSO does not actually happen.
More information about the Gcc-bugs
mailing list