https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102452
--- Comment #5 from rguenther at suse dot de <rguenther at suse dot de> --- On Thu, 23 Sep 2021, pinskia at gcc dot gnu.org wrote: > 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. Are you sure it's not SRA behaving differently? The IL inlined early is only showing in later dumps...