https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115606
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note CALL_EXPR_RETURN_SLOT_OPT is set in the C++ front-end:
else if (style == arg)
{
/* Just mark it addressable here, and leave the rest to
expand_call{,_inline}. */
cxx_mark_addressable (slot);
CALL_EXPR_RETURN_SLOT_OPT (call_expr) = true;
call_expr = cp_build_init_expr (slot, call_expr);
}
Which comes from:
enum style_t { ctor, arg, pcc } style;
if (AGGR_INIT_VIA_CTOR_P (aggr_init_expr))
style = ctor;
#ifdef PCC_STATIC_STRUCT_RETURN
else if (1)
style = pcc;
#endif
else
{
gcc_assert (TREE_ADDRESSABLE (type));
style = arg;
}
>- why return slot opt at the gimple level is target specific?
It is not from gimple level, it is from the front-end which comes from target
specific.