This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Daniel Berlin <dberlin@dberlin.org> writes:
> I think I hit this bug yesterday when making load PRE work.
> Another fun "we have to resize an array when we split an edge" problem.
>
> Please try this patch.
>
> Hopefully, it'll apply. I have some other changes in the same tree, so
> i had to do some hand editing on the diff.
It does not apply but it does not look ok either, see below.
> If not, it should be easy to see what i'm trying to do anyway (prevent
> us from accessing a non existent array member).
>
>
> Index: tree-ssa-pre.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-pre.c,v
> retrieving revision 1.1.4.94
> diff -u -3 -p -r1.1.4.94 tree-ssa-pre.c
> --- tree-ssa-pre.c 24 Oct 2003 07:41:31 -0000 1.1.4.94
> +++ tree-ssa-pre.c 29 Oct 2003 15:03:21 -0000
> @@ -323,7 +323,8 @@ struct expr_info
>
> /* Cache of expressions generated for given phi operand, to avoid
> recomputation and wasting memory. */
> -tree *phi_pred_cache;
> +static tree *phi_pred_cache;
> +static int n_phi_preds;
>
> /* Trying to lookup ephi pred operand indexes takes forever on graphs
> that have high connectivity because it's an O(n) linked list
> @@ -1193,7 +1224,6 @@
> /* Make a copy of Z as it would look in BB j, using the PHIs in BB. */
>
> static tree
> subst_phis (struct expr_info *ei, tree Z, basic_block j, basic_block bb)
> {
> tree stmt_copy;
> - if (phi_pred_cache[j->index] != NULL_TREE)
This line looks broken. Do you really intend this?
> @@ -1200,6 +1232,12 @@
> +
> + /* Return the cached version, if we have one. */
> + if (j->index < n_phi_preds
> + && phi_pred_cache[j->index] != NULL_TREE)
> return phi_pred_cache[j->index];
> +
> + /* Otherwise, generate a new expression. */
> pre_stats.exprs_generated++;
> stmt_copy = unshare_expr (Z);
> create_stmt_ann (stmt_copy);
> modify_stmt (stmt_copy);
> get_stmt_operands (stmt_copy);
> @@ -1210,1 +1248,0 @@
> - phi_pred_cache[j->index] = stmt_copy;
> @@ -1211,3 +1273,6 @@
> +
> + if (j->index < n_phi_preds)
> + phi_pred_cache[j->index] = stmt_copy;
> return stmt_copy;
> }
>
> @@ -3045,6 +3129,7 @@ pre_expression (struct expr_info *slot,
> bitmap_clear (created_phi_preds);
> ephi_pindex_htab = htab_create (500, ephi_pindex_hash, ephi_pindex_eq, free);
> phi_pred_cache = xcalloc (last_basic_block, sizeof (tree));
> + n_phi_preds = last_basic_block;
>
> if (!expr_phi_insertion ((bitmap *)data, ei))
> goto cleanup;
Andreas
--
Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
Attachment:
pgp00000.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |