aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2011-04-15 19:48:25 +0000
committerMichael Matz <matz@gcc.gnu.org>2011-04-15 19:48:25 +0000
commit63d2a3533fb013061b3a20ddcc26233d6368de32 (patch)
tree2ca8a4769f794f0a8bad0116318e591f72ee7e8e /gcc/tree-inline.c
parentdee74c343634bec2e6909f197ce0b669820acc56 (diff)
downloadgcc-63d2a3533fb013061b3a20ddcc26233d6368de32.zip
gcc-63d2a3533fb013061b3a20ddcc26233d6368de32.tar.gz
gcc-63d2a3533fb013061b3a20ddcc26233d6368de32.tar.bz2
tree.h (ALLOCA_FOR_VAR_P): Rename to CALL_ALLOCA_FOR_VAR_P.
* tree.h (ALLOCA_FOR_VAR_P): Rename to CALL_ALLOCA_FOR_VAR_P. * builtins.c (expand_builtin): Use CALL_ALLOCA_FOR_VAR_P. * function.c (gimplify_parameters): Ditto. * gimplify.c (gimplify_vla_decl): Ditto. * 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 CALL_ALLOCA_FOR_VAR_P state. * cfgexpand.c (expand_call_stmt): Restore CALL_ALLOCA_FOR_VAR_P state. * tree-inline.c (inline_forbidden_p_stmt): Don't reject alloca calls if they were for VLA objects. From-SVN: r172516
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 84307ac..79c9538 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -2997,8 +2997,11 @@ inline_forbidden_p_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
this may change program's memory overhead drastically when the
function using alloca is called in loop. In GCC present in
SPEC2000 inlining into schedule_block cause it to require 2GB of
- RAM instead of 256MB. */
+ RAM instead of 256MB. Don't do so for alloca calls emitted for
+ VLA objects as those can't cause unbounded growth (they're always
+ wrapped inside stack_save/stack_restore regions. */
if (gimple_alloca_call_p (stmt)
+ && !gimple_call_alloca_for_var_p (stmt)
&& !lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
{
inline_forbidden_reason