Commit ab4472fa by Richard Guenther Committed by Richard Biener

re PR middle-end/48590 (Alias analysis confused by builtin-stack-save/restore)

2011-04-14  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/48590
	* tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Handle
	BUILT_IN_ALLOCA, BUILT_IN_STACK_SAVE and BUILT_IN_STACK_RESTORE.
	(call_may_clobber_ref_p_1): Handle BUILT_IN_ALLOCA and
	BUILT_IN_STACK_SAVE.
	* tree-ssa-dce.c (propagate_necessity): Handle
	BUILT_IN_ALLOCA, BUILT_IN_STACK_SAVE and BUILT_IN_STACK_RESTORE.

From-SVN: r172427
parent 32dabdaf
2011-04-14 Richard Guenther <rguenther@suse.de>
PR tree-optimization/48590
* tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Handle
BUILT_IN_ALLOCA, BUILT_IN_STACK_SAVE and BUILT_IN_STACK_RESTORE.
(call_may_clobber_ref_p_1): Handle BUILT_IN_ALLOCA and
BUILT_IN_STACK_SAVE.
* tree-ssa-dce.c (propagate_necessity): Handle
BUILT_IN_ALLOCA, BUILT_IN_STACK_SAVE and BUILT_IN_STACK_RESTORE.
2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com> 2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com>
* c-parser.c (c_parser_objc_class_declaration): Updated call to * c-parser.c (c_parser_objc_class_declaration): Updated call to
......
...@@ -1196,6 +1196,9 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref) ...@@ -1196,6 +1196,9 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref)
case BUILT_IN_FREE: case BUILT_IN_FREE:
case BUILT_IN_MALLOC: case BUILT_IN_MALLOC:
case BUILT_IN_CALLOC: case BUILT_IN_CALLOC:
case BUILT_IN_ALLOCA:
case BUILT_IN_STACK_SAVE:
case BUILT_IN_STACK_RESTORE:
case BUILT_IN_MEMSET: case BUILT_IN_MEMSET:
case BUILT_IN_FREXP: case BUILT_IN_FREXP:
case BUILT_IN_FREXPF: case BUILT_IN_FREXPF:
...@@ -1432,6 +1435,9 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) ...@@ -1432,6 +1435,9 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref)
&& targetm.ref_may_alias_errno (ref)) && targetm.ref_may_alias_errno (ref))
return true; return true;
return false; return false;
case BUILT_IN_STACK_SAVE:
case BUILT_IN_ALLOCA:
return false;
/* Freeing memory kills the pointed-to memory. More importantly /* Freeing memory kills the pointed-to memory. More importantly
the call has to serve as a barrier for moving loads and stores the call has to serve as a barrier for moving loads and stores
across it. */ across it. */
......
...@@ -824,7 +824,10 @@ propagate_necessity (struct edge_list *el) ...@@ -824,7 +824,10 @@ propagate_necessity (struct edge_list *el)
&& DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL
&& (DECL_FUNCTION_CODE (callee) == BUILT_IN_MEMSET && (DECL_FUNCTION_CODE (callee) == BUILT_IN_MEMSET
|| DECL_FUNCTION_CODE (callee) == BUILT_IN_MALLOC || DECL_FUNCTION_CODE (callee) == BUILT_IN_MALLOC
|| DECL_FUNCTION_CODE (callee) == BUILT_IN_FREE)) || DECL_FUNCTION_CODE (callee) == BUILT_IN_FREE
|| DECL_FUNCTION_CODE (callee) == BUILT_IN_ALLOCA
|| DECL_FUNCTION_CODE (callee) == BUILT_IN_STACK_SAVE
|| DECL_FUNCTION_CODE (callee) == BUILT_IN_STACK_RESTORE))
continue; continue;
/* Calls implicitly load from memory, their arguments /* Calls implicitly load from memory, their arguments
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment