> We have a flag for this already on the CALL_EXPR.  But we don't retain it
> over tuples, and hence we also don't look at it in
> inline_forbidden_p_stmt.  This patch fixes both.  (The strange testing of
> builtin-ness is because in CALL_EXPR the ALLOCA_FOR_VAR_P and
> CALL_FROM_THUNK_P flags are overloaded)

More precisely, we don't expose it on tuples; we do retain it over tuples since 
we tuplify CALL_FROM_THUNK_P and we rematerialize it in expand_call_stmt.  The 
flag is later passed to expand_builtin_alloca.

>       * gimple.h (enum gf_mask): Add GF_CALL_ALLOCA_FOR_VAR.
>       (gimple_call_set_alloca_for_var): New inline function.
>       (gimple_call_alloca_for_var_p): Ditto.
>       * gimple.c (gimple_build_call_from_tree): Remember ALLOCA_FOR_VAR_P
>       state.
>       * cfgexpand.c (expand_call_stmt): Restore ALLOCA_FOR_VAR_P state.
>
>       * tree-inline.c (inline_forbidden_p_stmt): Don't reject alloca
>       calls if they were for VLA objects.

Nice patch.  The idea also occurred to me recently because we often run into 
the inlining limitation in Ada.

Btw, I don't remember why I chose ALLOCA_FOR_VAR_P over CALL_ALLOCA_FOR_VAR_P 
but, given the name of the GIMPLE flag and predicate, it's probably time to 
change it.

-- 
Eric Botcazou

Reply via email to