diff options
author | Richard Guenther <rguenther@suse.de> | 2006-06-21 08:11:28 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2006-06-21 08:11:28 +0000 |
commit | b16fb82dac5eea61c804fa8538ea4d1600f0a919 (patch) | |
tree | 9cf8df85c5cbde4359653bfd0afd0fa5b7e562c7 /gcc | |
parent | 470145e722602c492436baa4b77098121569eeb5 (diff) | |
download | gcc-b16fb82dac5eea61c804fa8538ea4d1600f0a919.zip gcc-b16fb82dac5eea61c804fa8538ea4d1600f0a919.tar.gz gcc-b16fb82dac5eea61c804fa8538ea4d1600f0a919.tar.bz2 |
tree-ssa-loop-niter.c (simplify_using_initial_conditions): Limit iteration over the dominators.
2006-06-21 Richrad Guenther <rguenther@suse.de>
* tree-ssa-loop-niter.c (simplify_using_initial_conditions):
Limit iteration over the dominators.
From-SVN: r114840
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-niter.c | 14 |
2 files changed, 17 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index de72952..9b190b4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2006-06-21 Richrad Guenther <rguenther@suse.de> + + * tree-ssa-loop-niter.c (simplify_using_initial_conditions): + Limit iteration over the dominators. + 2006-06-20 Roger Sayle <roger@eyesopen.com> * config/mips/iris6.h (LIB_SPEC): Add support for -pthread. diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index a896d03..9428dd6 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -886,7 +886,12 @@ tree_simplify_using_condition (tree cond, tree expr) return tree_simplify_using_condition_1 (cond, expr); } - + +/* The maximum number of dominator BBs we search for conditions + of loop header copies we use for simplifying a conditional + expression. */ +#define MAX_DOMINATORS_TO_WALK 8 + /* Tries to simplify EXPR using the conditions on entry to LOOP. Record the conditions used for simplification to CONDS_USED. Returns the simplified expression (or EXPR unchanged, if no @@ -899,12 +904,16 @@ simplify_using_initial_conditions (struct loop *loop, tree expr, edge e; basic_block bb; tree exp, cond; + int cnt = 0; if (TREE_CODE (expr) == INTEGER_CST) return expr; + /* Limit walking the dominators to avoid quadraticness in + the number of BBs times the number of loops in degenerate + cases. */ for (bb = loop->header; - bb != ENTRY_BLOCK_PTR; + bb != ENTRY_BLOCK_PTR && cnt < MAX_DOMINATORS_TO_WALK; bb = get_immediate_dominator (CDI_DOMINATORS, bb)) { if (!single_pred_p (bb)) @@ -926,6 +935,7 @@ simplify_using_initial_conditions (struct loop *loop, tree expr, cond); expr = exp; + ++cnt; } return expr; |