Commit fb1fe1f3 by Richard Biener Committed by Richard Biener

tree-cfgcleanup.c (cleanup_tree_cfg_noloop): Avoid compacting blocks if SCEV is active.

2017-10-10  Richard Biener  <rguenther@suse.de>

	* tree-cfgcleanup.c (cleanup_tree_cfg_noloop): Avoid compacting
	blocks if SCEV is active.
	* tree-scalar-evolution.c (analyze_scalar_evolution_1): Remove
	dead code.
	(analyze_scalar_evolution): Handle cached evolutions the obvious way.
	(scev_initialize): Assert we are not yet initialized.

From-SVN: r253585
parent 0c6ddd1d
2017-10-10 Richard Biener <rguenther@suse.de>
* tree-cfgcleanup.c (cleanup_tree_cfg_noloop): Avoid compacting
blocks if SCEV is active.
* tree-scalar-evolution.c (analyze_scalar_evolution_1): Remove
dead code.
(analyze_scalar_evolution): Handle cached evolutions the obvious way.
(scev_initialize): Assert we are not yet initialized.
2017-10-10 Bin Cheng <bin.cheng@arm.com> 2017-10-10 Bin Cheng <bin.cheng@arm.com>
* tree-loop-distribution.c (generate_loops_for_partition): Remove * tree-loop-distribution.c (generate_loops_for_partition): Remove
...@@ -892,7 +892,11 @@ cleanup_tree_cfg_noloop (void) ...@@ -892,7 +892,11 @@ cleanup_tree_cfg_noloop (void)
changed |= cleanup_tree_cfg_1 (); changed |= cleanup_tree_cfg_1 ();
gcc_assert (dom_info_available_p (CDI_DOMINATORS)); gcc_assert (dom_info_available_p (CDI_DOMINATORS));
compact_blocks ();
/* Do not renumber blocks if the SCEV cache is active, it is indexed by
basic-block numbers. */
if (! scev_initialized_p ())
compact_blocks ();
checking_verify_flow_info (); checking_verify_flow_info ();
......
...@@ -281,7 +281,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -281,7 +281,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa-propagate.h" #include "tree-ssa-propagate.h"
#include "gimple-fold.h" #include "gimple-fold.h"
static tree analyze_scalar_evolution_1 (struct loop *, tree, tree); static tree analyze_scalar_evolution_1 (struct loop *, tree);
static tree analyze_scalar_evolution_for_address_of (struct loop *loop, static tree analyze_scalar_evolution_for_address_of (struct loop *loop,
tree var); tree var);
...@@ -2036,18 +2036,19 @@ compute_scalar_evolution_in_loop (struct loop *wrto_loop, ...@@ -2036,18 +2036,19 @@ compute_scalar_evolution_in_loop (struct loop *wrto_loop,
if (no_evolution_in_loop_p (res, wrto_loop->num, &val) && val) if (no_evolution_in_loop_p (res, wrto_loop->num, &val) && val)
return res; return res;
return analyze_scalar_evolution_1 (wrto_loop, res, chrec_not_analyzed_yet); return analyze_scalar_evolution_1 (wrto_loop, res);
} }
/* Helper recursive function. */ /* Helper recursive function. */
static tree static tree
analyze_scalar_evolution_1 (struct loop *loop, tree var, tree res) analyze_scalar_evolution_1 (struct loop *loop, tree var)
{ {
tree type = TREE_TYPE (var); tree type = TREE_TYPE (var);
gimple *def; gimple *def;
basic_block bb; basic_block bb;
struct loop *def_loop; struct loop *def_loop;
tree res;
if (loop == NULL if (loop == NULL
|| TREE_CODE (type) == VECTOR_TYPE || TREE_CODE (type) == VECTOR_TYPE
...@@ -2069,18 +2070,9 @@ analyze_scalar_evolution_1 (struct loop *loop, tree var, tree res) ...@@ -2069,18 +2070,9 @@ analyze_scalar_evolution_1 (struct loop *loop, tree var, tree res)
goto set_and_end; goto set_and_end;
} }
if (res != chrec_not_analyzed_yet)
{
if (loop != bb->loop_father)
res = compute_scalar_evolution_in_loop
(find_common_loop (loop, bb->loop_father), bb->loop_father, res);
goto set_and_end;
}
if (loop != def_loop) if (loop != def_loop)
{ {
res = analyze_scalar_evolution_1 (def_loop, var, chrec_not_analyzed_yet); res = analyze_scalar_evolution_1 (def_loop, var);
res = compute_scalar_evolution_in_loop (loop, def_loop, res); res = compute_scalar_evolution_in_loop (loop, def_loop, res);
goto set_and_end; goto set_and_end;
...@@ -2144,7 +2136,8 @@ analyze_scalar_evolution (struct loop *loop, tree var) ...@@ -2144,7 +2136,8 @@ analyze_scalar_evolution (struct loop *loop, tree var)
} }
res = get_scalar_evolution (block_before_loop (loop), var); res = get_scalar_evolution (block_before_loop (loop), var);
res = analyze_scalar_evolution_1 (loop, var, res); if (res == chrec_not_analyzed_yet)
res = analyze_scalar_evolution_1 (loop, var);
if (dump_file && (dump_flags & TDF_SCEV)) if (dump_file && (dump_flags & TDF_SCEV))
fprintf (dump_file, ")\n"); fprintf (dump_file, ")\n");
...@@ -3264,6 +3257,8 @@ scev_initialize (void) ...@@ -3264,6 +3257,8 @@ scev_initialize (void)
{ {
struct loop *loop; struct loop *loop;
gcc_assert (! scev_initialized_p ());
scalar_evolution_info = hash_table<scev_info_hasher>::create_ggc (100); scalar_evolution_info = hash_table<scev_info_hasher>::create_ggc (100);
initialize_scalar_evolutions_analyzer (); initialize_scalar_evolutions_analyzer ();
......
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