diff options
author | wilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4> | 1994-02-01 00:02:12 +0000 |
---|---|---|
committer | wilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4> | 1994-02-01 00:02:12 +0000 |
commit | a1d60baf349b8c68baa322c45126243ae6f12fa1 (patch) | |
tree | 18f4c44ca784cbfb083ef875114f14e1bb48d1c7 | |
parent | 204bdce0016348fa537db98a5ebb29d6ffd1d30b (diff) | |
download | gcc-a1d60baf349b8c68baa322c45126243ae6f12fa1.tar.gz |
(find_best_addr): Limit number of cse_gen_binary calls to
20 per iteration.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@6449 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cse.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cse.c b/gcc/cse.c index 13de40cb340..45e7d4445f4 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -2649,9 +2649,17 @@ find_best_addr (insn, loc) int best_rtx_cost = (COST (*loc) + 1) >> 1; struct table_elt *best_elt = elt; rtx best_rtx = *loc; + int count; + + /* This is at worst case an O(n^2) algorithm, so limit our search + to the first 32 elements on the list. This avoids trouble + compiling code with very long basic blocks that can easily + call cse_gen_binary so many times that we run out of memory. */ found_better = 0; - for (p = elt->first_same_value; p; p = p->next_same_value) + for (p = elt->first_same_value, count = 0; + p && count < 32; + p = p->next_same_value, count++) if (! p->flag && (GET_CODE (p->exp) == REG || exp_equiv_p (p->exp, p->exp, 1, 0))) |