Commit 21392f19 by Daniel Berlin Committed by Daniel Berlin

Fix PR tree-optimization/28778 Fix PR tree-optimization/29156 Fix PR tree-optimization/29415

2006-10-19  Daniel Berlin  <dberlin@dberlin.org>

	Fix PR tree-optimization/28778
	Fix PR tree-optimization/29156
	Fix PR tree-optimization/29415
	* tree.h (DECL_PTA_ARTIFICIAL): New macro.
	(tree_decl_with_vis): Add artificial_pta_var flag.
	* tree-ssa-alias.c (is_escape_site): Remove alias info argument,
	pushed into callers.
	* tree-ssa-structalias.c (nonlocal_for_type): New variable.
	(nonlocal_all): Ditto.
	(struct variable_info): Add directly_dereferenced member.
	(var_escaped_vars): New variable.
	(escaped_vars_tree): Ditto.
	(escaped_vars_id): Ditto.
	(nonlocal_vars_id): Ditto.
	(new_var_info): Set directly_dereferenced.
	(graph_size): New variable
	(build_constraint_graph): Use graph_size.
	(solve_graph): Don't process constraints that cannot change the
	solution, don't try to propagate an empty solution to our
	successors.
	(process_constraint): Set directly_dereferenced.
	(could_have_pointers): New function.
	(get_constraint_for_component_ref): Don't process STRING_CST.
	(nonlocal_lookup): New function.
	(nonlocal_insert): Ditto.
	(create_nonlocal_var): Ditto.
	(get_nonlocal_id_for_type): Ditto.
	(get_constraint_for): Allow results vector to be empty in the case
	of string constants.
	Handle results of calls properly.
	(update_alias_info): Update alias info stats on number and type of
	calls.
	(find_func_aliases): Use could_have_pointers.
	(make_constraint_from_escaped): Renamed from
	make_constraint_to_anything, and changed to make constraints from
	escape variable.
	(make_constraint_to_escaped): New function.
	(find_global_initializers): Ditto.
	(create_variable_info_for): Make constraint from escaped to any
	global variable, and from any global variable to the set of
	escaped vars.
	(intra_create_variable_infos): Deal with escaped instead of
	pointing to anything.
	(set_uids_in_ptset): Do type pruning on directly dereferenced
	variables.
	(find_what_p_points_to): Adjust call to set_uids_with_ptset.
	(init_base_vars): Fix comment, and initialize escaped_vars.
	(need_to_solve): Removed.
	(find_escape_constraints): New function.
	(expand_nonlocal_solutions): Ditto.
	(compute_points_to_sets): Call find_escape_constraints and
	expand_nonlocal_solutions.
	(delete_points_to_sets): Don't fall off the end of the graph.
	(init_alias_heapvars): Initialize nonlocal_for_type and
	nonlocal_all.
	(delete_alias_heapvars): Free nonlocal_for_type and null out
	nonlocal_all.

From-SVN: r117891
parent 3d894fc3
2006-10-19 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/28778
Fix PR tree-optimization/29156
Fix PR tree-optimization/29415
* tree.h (DECL_PTA_ARTIFICIAL): New macro.
(tree_decl_with_vis): Add artificial_pta_var flag.
* tree-ssa-alias.c (is_escape_site): Remove alias info argument,
pushed into callers.
* tree-ssa-structalias.c (nonlocal_for_type): New variable.
(nonlocal_all): Ditto.
(struct variable_info): Add directly_dereferenced member.
(var_escaped_vars): New variable.
(escaped_vars_tree): Ditto.
(escaped_vars_id): Ditto.
(nonlocal_vars_id): Ditto.
(new_var_info): Set directly_dereferenced.
(graph_size): New variable
(build_constraint_graph): Use graph_size.
(solve_graph): Don't process constraints that cannot change the
solution, don't try to propagate an empty solution to our
successors.
(process_constraint): Set directly_dereferenced.
(could_have_pointers): New function.
(get_constraint_for_component_ref): Don't process STRING_CST.
(nonlocal_lookup): New function.
(nonlocal_insert): Ditto.
(create_nonlocal_var): Ditto.
(get_nonlocal_id_for_type): Ditto.
(get_constraint_for): Allow results vector to be empty in the case
of string constants.
Handle results of calls properly.
(update_alias_info): Update alias info stats on number and type of
calls.
(find_func_aliases): Use could_have_pointers.
(make_constraint_from_escaped): Renamed from
make_constraint_to_anything, and changed to make constraints from
escape variable.
(make_constraint_to_escaped): New function.
(find_global_initializers): Ditto.
(create_variable_info_for): Make constraint from escaped to any
global variable, and from any global variable to the set of
escaped vars.
(intra_create_variable_infos): Deal with escaped instead of
pointing to anything.
(set_uids_in_ptset): Do type pruning on directly dereferenced
variables.
(find_what_p_points_to): Adjust call to set_uids_with_ptset.
(init_base_vars): Fix comment, and initialize escaped_vars.
(need_to_solve): Removed.
(find_escape_constraints): New function.
(expand_nonlocal_solutions): Ditto.
(compute_points_to_sets): Call find_escape_constraints and
expand_nonlocal_solutions.
(delete_points_to_sets): Don't fall off the end of the graph.
(init_alias_heapvars): Initialize nonlocal_for_type and
nonlocal_all.
(delete_alias_heapvars): Free nonlocal_for_type and null out
nonlocal_all.
2006-10-19 Eric Botcazou <ebotcazou@adacore.com>
* fold-const.c (add_double): Rename to add_double_with_sign.
......
extern void abort(void);
typedef long GLint;
void aglChoosePixelFormat (const GLint *);
void
find (const int *alistp)
{
const int *blist;
int list[32];
if (alistp)
blist = alistp;
else
{
list[3] = 42;
blist = list;
}
aglChoosePixelFormat ((GLint *) blist);
}
void
aglChoosePixelFormat (const GLint * a)
{
int *b = (int *) a;
if (b[3] != 42)
abort ();
}
int
main (void)
{
find (0);
return 0;
}
extern void abort(void);
struct test1
{
int a;
int b;
};
struct test2
{
float d;
struct test1 sub;
};
int global;
int bla(struct test1 *xa, struct test2 *xb)
{
global = 1;
xb->sub.a = 1;
xa->a = 8;
return xb->sub.a;
}
int main(void)
{
struct test2 pom;
if (bla (&pom.sub, &pom) != 8)
abort ();
return 0;
}
......@@ -22,5 +22,5 @@ double f(double a)
}
/* The points-to set of the final function pointer should be "sin cos" */
/* { dg-final { scan-tree-dump-times "sin cos" 1 "alias1"} } */
/* { dg-final { scan-tree-dump-times "{ sin cos }" 1 "alias1"} } */
/* { dg-final { cleanup-tree-dump "alias1" } } */
......@@ -2103,24 +2103,17 @@ set_pt_anything (tree ptr)
3- STMT is an assignment to a non-local variable, or
4- STMT is a return statement.
AI points to the alias information collected so far.
Return the type of escape site found, if we found one, or NO_ESCAPE
if none. */
enum escape_type
is_escape_site (tree stmt, struct alias_info *ai)
is_escape_site (tree stmt)
{
tree call = get_call_expr_in (stmt);
if (call != NULL_TREE)
{
ai->num_calls_found++;
if (!TREE_SIDE_EFFECTS (call))
{
ai->num_pure_const_calls_found++;
return ESCAPE_TO_PURE_CONST;
}
return ESCAPE_TO_PURE_CONST;
return ESCAPE_TO_CALL;
}
......
......@@ -1053,6 +1053,9 @@ access_can_touch_variable (tree ref, tree alias, HOST_WIDE_INT offset,
if (alias == global_var)
return true;
if (TREE_CODE (alias) == VAR_DECL && DECL_PTA_ARTIFICIAL (alias))
return true;
/* If ALIAS is an SFT, it can't be touched if the offset
and size of the access is not overlapping with the SFT offset and
size. This is only true if we are accessing through a pointer
......
......@@ -81,7 +81,7 @@ struct alias_info
#define NUM_REFERENCES_SET(ANN, VAL) (ANN)->common.aux = (void*) ((void *)(VAL))
/* In tree-ssa-alias.c. */
enum escape_type is_escape_site (tree, struct alias_info *);
enum escape_type is_escape_site (tree);
/* In tree-ssa-structalias.c. */
extern void compute_points_to_sets (struct alias_info *);
......
......@@ -2858,6 +2858,10 @@ extern void decl_restrict_base_insert (tree, tree);
multiple translation units should be merged. */
#define DECL_ONE_ONLY(NODE) (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.one_only)
/* Internal to points-to analysis and operand scanning. Indicates
that this DECL is an artificial points-to variable. */
#define DECL_PTA_ARTIFICIAL(NODE) (VAR_DECL_CHECK (NODE)->decl_with_vis.artificial_pta_var)
struct tree_decl_with_vis GTY(())
{
struct tree_decl_with_rtl common;
......@@ -2875,6 +2879,7 @@ struct tree_decl_with_vis GTY(())
unsigned based_on_restrict_p : 1;
/* Used by C++. Might become a generic decl flag. */
unsigned shadowed_for_var_p : 1;
unsigned artificial_pta_var : 1;
/* Don't belong to VAR_DECL exclusively. */
unsigned in_system_header_flag : 1;
......@@ -2889,7 +2894,7 @@ struct tree_decl_with_vis GTY(())
/* Belongs to VAR_DECL exclusively. */
ENUM_BITFIELD(tls_model) tls_model : 3;
/* 11 unused bits. */
/* 10 unused bits. */
};
/* In a VAR_DECL that's static,
......
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