+2016-07-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR middle-end/71876
+ * calls.c (gimple_maybe_alloca_call_p): New function. Return true
+ if STMT may be an alloca call.
+ (gimple_alloca_call_p, alloca_call_p): Return only true for the
+ builtin alloca call.
+ * calls.h (gimple_maybe_alloca_call_p): New function.
+ * tree-inline.c (inline_forbidden_p_stmt): Use
+ gimple_maybe_alloca_call_p here.
+
2016-07-21 David Malcolm <dmalcolm@redhat.com>
* spellcheck-tree.c (best_macro_match::best_macro_match):
}
-/* Return true if STMT is an alloca call. */
+/* Return true if STMT may be an alloca call. */
bool
-gimple_alloca_call_p (const gimple *stmt)
+gimple_maybe_alloca_call_p (const gimple *stmt)
{
tree fndecl;
return false;
}
-/* Return true when exp contains alloca call. */
+/* Return true if STMT is a builtin alloca call. */
+
+bool
+gimple_alloca_call_p (const gimple *stmt)
+{
+ tree fndecl;
+
+ if (!is_gimple_call (stmt))
+ return false;
+
+ fndecl = gimple_call_fndecl (stmt);
+ if (fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ switch (DECL_FUNCTION_CODE (fndecl))
+ {
+ case BUILT_IN_ALLOCA:
+ case BUILT_IN_ALLOCA_WITH_ALIGN:
+ return true;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+/* Return true when exp contains a builtin alloca call. */
bool
alloca_call_p (const_tree exp)
tree fndecl;
if (TREE_CODE (exp) == CALL_EXPR
&& (fndecl = get_callee_fndecl (exp))
- && (special_function_p (fndecl, 0) & ECF_MAY_BE_ALLOCA))
- return true;
+ && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
+ switch (DECL_FUNCTION_CODE (fndecl))
+ {
+ case BUILT_IN_ALLOCA:
+ case BUILT_IN_ALLOCA_WITH_ALIGN:
+ return true;
+ default:
+ break;
+ }
+
return false;
}
extern int flags_from_decl_or_type (const_tree);
extern int call_expr_flags (const_tree);
extern int setjmp_call_p (const_tree);
+extern bool gimple_maybe_alloca_call_p (const gimple *);
extern bool gimple_alloca_call_p (const gimple *);
extern bool alloca_call_p (const_tree);
extern bool must_pass_in_stack_var_size (machine_mode, const_tree);
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)
+ if (gimple_maybe_alloca_call_p (stmt)
&& !gimple_call_alloca_for_var_p (as_a <gcall *> (stmt))
&& !lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
{