Commit 1ec87690 by Richard Guenther Committed by Richard Biener

re PR tree-optimization/47615 (ICE: too deep recursion in…

re PR tree-optimization/47615 (ICE: too deep recursion in phi_translate/phi_translate_1 with -ftree-pre -fno-tree-fre -fno-tree-sra)

2011-02-07  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/47615
	* tree-ssa-sccvn.h (run_scc_vn): Take a vn-walk mode argument.
	* tree-ssa-sccvn.c (default_vn_walk_kind): New global.
	(run_scc_vn): Initialize it.
	(visit_reference_op_load): Use it.
	* tree-ssa-pre.c (execute_pre): Use VN_WALK if in PRE.

	* g++.dg/opt/pr47615.C: New testcase.

From-SVN: r169888
parent b46ae6da
2011-02-07 Richard Guenther <rguenther@suse.de>
PR tree-optimization/47615
* tree-ssa-sccvn.h (run_scc_vn): Take a vn-walk mode argument.
* tree-ssa-sccvn.c (default_vn_walk_kind): New global.
(run_scc_vn): Initialize it.
(visit_reference_op_load): Use it.
* tree-ssa-pre.c (execute_pre): Use VN_WALK if in PRE.
2011-02-07 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> 2011-02-07 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* config/spu/spu.c (spu_init_libfuncs): Install SImode and * config/spu/spu.c (spu_init_libfuncs): Install SImode and
......
2011-02-07 Richard Guenther <rguenther@suse.de> 2011-02-07 Richard Guenther <rguenther@suse.de>
PR tree-optimization/47615
* g++.dg/opt/pr47615.C: New testcase.
2011-02-07 Richard Guenther <rguenther@suse.de>
PR tree-optimization/47621 PR tree-optimization/47621
* gcc.dg/torture/pr47621.c: New testcase. * gcc.dg/torture/pr47621.c: New testcase.
......
...@@ -4853,7 +4853,7 @@ execute_pre (bool do_fre) ...@@ -4853,7 +4853,7 @@ execute_pre (bool do_fre)
if (!do_fre) if (!do_fre)
loop_optimizer_init (LOOPS_NORMAL); loop_optimizer_init (LOOPS_NORMAL);
if (!run_scc_vn ()) if (!run_scc_vn (do_fre ? VN_WALKREWRITE : VN_WALK))
{ {
if (!do_fre) if (!do_fre)
loop_optimizer_finalize (); loop_optimizer_finalize ();
......
...@@ -1244,6 +1244,7 @@ vn_reference_lookup_1 (vn_reference_t vr, vn_reference_t *vnresult) ...@@ -1244,6 +1244,7 @@ vn_reference_lookup_1 (vn_reference_t vr, vn_reference_t *vnresult)
static tree *last_vuse_ptr; static tree *last_vuse_ptr;
static vn_lookup_kind vn_walk_kind; static vn_lookup_kind vn_walk_kind;
static vn_lookup_kind default_vn_walk_kind;
/* Callback for walk_non_aliased_vuses. Adjusts the vn_reference_t VR_ /* Callback for walk_non_aliased_vuses. Adjusts the vn_reference_t VR_
with the current VUSE and performs the expression lookup. */ with the current VUSE and performs the expression lookup. */
...@@ -2261,14 +2262,15 @@ visit_reference_op_load (tree lhs, tree op, gimple stmt) ...@@ -2261,14 +2262,15 @@ visit_reference_op_load (tree lhs, tree op, gimple stmt)
last_vuse = gimple_vuse (stmt); last_vuse = gimple_vuse (stmt);
last_vuse_ptr = &last_vuse; last_vuse_ptr = &last_vuse;
result = vn_reference_lookup (op, gimple_vuse (stmt), VN_WALKREWRITE, NULL); result = vn_reference_lookup (op, gimple_vuse (stmt),
default_vn_walk_kind, NULL);
last_vuse_ptr = NULL; last_vuse_ptr = NULL;
/* If we have a VCE, try looking up its operand as it might be stored in /* If we have a VCE, try looking up its operand as it might be stored in
a different type. */ a different type. */
if (!result && TREE_CODE (op) == VIEW_CONVERT_EXPR) if (!result && TREE_CODE (op) == VIEW_CONVERT_EXPR)
result = vn_reference_lookup (TREE_OPERAND (op, 0), gimple_vuse (stmt), result = vn_reference_lookup (TREE_OPERAND (op, 0), gimple_vuse (stmt),
VN_WALKREWRITE, NULL); default_vn_walk_kind, NULL);
/* We handle type-punning through unions by value-numbering based /* We handle type-punning through unions by value-numbering based
on offset and size of the access. Be prepared to handle a on offset and size of the access. Be prepared to handle a
...@@ -3463,15 +3465,18 @@ set_hashtable_value_ids (void) ...@@ -3463,15 +3465,18 @@ set_hashtable_value_ids (void)
} }
/* Do SCCVN. Returns true if it finished, false if we bailed out /* Do SCCVN. Returns true if it finished, false if we bailed out
due to resource constraints. */ due to resource constraints. DEFAULT_VN_WALK_KIND_ specifies
how we use the alias oracle walking during the VN process. */
bool bool
run_scc_vn (void) run_scc_vn (vn_lookup_kind default_vn_walk_kind_)
{ {
size_t i; size_t i;
tree param; tree param;
bool changed = true; bool changed = true;
default_vn_walk_kind = default_vn_walk_kind_;
init_scc_vn (); init_scc_vn ();
current_info = valid_info; current_info = valid_info;
......
...@@ -165,11 +165,13 @@ typedef struct vn_ssa_aux ...@@ -165,11 +165,13 @@ typedef struct vn_ssa_aux
unsigned needs_insertion : 1; unsigned needs_insertion : 1;
} *vn_ssa_aux_t; } *vn_ssa_aux_t;
typedef enum { VN_NOWALK, VN_WALK, VN_WALKREWRITE } vn_lookup_kind;
/* Return the value numbering info for an SSA_NAME. */ /* Return the value numbering info for an SSA_NAME. */
extern vn_ssa_aux_t VN_INFO (tree); extern vn_ssa_aux_t VN_INFO (tree);
extern vn_ssa_aux_t VN_INFO_GET (tree); extern vn_ssa_aux_t VN_INFO_GET (tree);
tree vn_get_expr_for (tree); tree vn_get_expr_for (tree);
bool run_scc_vn (void); bool run_scc_vn (vn_lookup_kind);
void free_scc_vn (void); void free_scc_vn (void);
tree vn_nary_op_lookup (tree, vn_nary_op_t *); tree vn_nary_op_lookup (tree, vn_nary_op_t *);
tree vn_nary_op_lookup_stmt (gimple, vn_nary_op_t *); tree vn_nary_op_lookup_stmt (gimple, vn_nary_op_t *);
...@@ -187,7 +189,6 @@ void copy_reference_ops_from_ref (tree, VEC(vn_reference_op_s, heap) **); ...@@ -187,7 +189,6 @@ void copy_reference_ops_from_ref (tree, VEC(vn_reference_op_s, heap) **);
void copy_reference_ops_from_call (gimple, VEC(vn_reference_op_s, heap) **); void copy_reference_ops_from_call (gimple, VEC(vn_reference_op_s, heap) **);
bool ao_ref_init_from_vn_reference (ao_ref *, alias_set_type, tree, bool ao_ref_init_from_vn_reference (ao_ref *, alias_set_type, tree,
VEC (vn_reference_op_s, heap) *); VEC (vn_reference_op_s, heap) *);
typedef enum { VN_NOWALK, VN_WALK, VN_WALKREWRITE } vn_lookup_kind;
tree vn_reference_lookup_pieces (tree, alias_set_type, tree, tree vn_reference_lookup_pieces (tree, alias_set_type, tree,
VEC (vn_reference_op_s, heap) *, VEC (vn_reference_op_s, heap) *,
vn_reference_t *, vn_lookup_kind); vn_reference_t *, vn_lookup_kind);
......
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