This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: ivopts improvement
- From: Zdenek Dvorak <rakdver at kam dot mff dot cuni dot cz>
- To: Tom de Vries <vries at codesourcery dot com>
- Cc: Paolo Bonzini <bonzini at gnu dot org>, Richard Guenther <richard dot guenther at gmail dot com>, gcc-patches at gcc dot gnu dot org, Bernd Schmidt <bernds at codesourcery dot com>, Maxim Kuvyrkov <maxim at codesourcery dot com>
- Date: Mon, 14 Mar 2011 10:58:34 +0100
- Subject: Re: ivopts improvement
- References: <4D6B7AFD.6000201@gnu.org> <4D6BAF92.3030707@codesourcery.com> <4D6BB48A.9090003@gnu.org> <AANLkTi=-0CJ=W7JXYs9sBZw7ic6W0SYU9tmJVr+YHh5J@mail.gmail.com> <20110228181222.GA24295@kam.mff.cuni.cz> <4D6EBE2A.10002@codesourcery.com> <4D6F550B.9060400@gnu.org> <4D6FA591.6060604@codesourcery.com> <20110304223704.GA9660@kam.mff.cuni.cz> <4D7D005B.6000002@codesourcery.com>
Hi,
> diff -u gcc/tree-ssa-loop-ivopts.c gcc/tree-ssa-loop-ivopts.c
> --- gcc/tree-ssa-loop-ivopts.c (working copy)
> +++ gcc/tree-ssa-loop-ivopts.c (working copy)
> @@ -1194,6 +1300,7 @@ record_use (struct ivopts_data *data, tr
> gimple stmt, enum use_type use_type)
> {
> struct iv_use *use = XCNEW (struct iv_use);
> + tree tmp;
>
> use->id = n_iv_uses (data);
> use->type = use_type;
> @@ -1204,11 +1311,14 @@ record_use (struct ivopts_data *data, tr
>
> /* To avoid showing ssa name in the dumps, if it was not reset by the
> caller. */
> + tmp = iv->ssa_name;
> iv->ssa_name = NULL_TREE;
>
> if (dump_file && (dump_flags & TDF_DETAILS))
> dump_use (dump_file, use);
>
> + iv->ssa_name = tmp;
> +
> VEC_safe_push (iv_use_p, heap, data->iv_uses, use);
>
> return use;
this is not ok. You can get the ssa name from extract_cond_operands.
> + /* Determine if the exit test is formulated in terms of the phi or the
> + increment of the use iv. */
> + use_uses_inced_iv
> + = gimple_code (SSA_NAME_DEF_STMT (use->iv->ssa_name)) != GIMPLE_PHI;
> +
> + /* Determine if the exit test is before or after the increment of the
> + cand. */
> + use_after_cand_inc
> + = stmt_after_increment (data->current_loop, cand, use->stmt);
> +
> + /* For now, we only handle these cases. */
> + if (use_after_cand_inc != use_uses_inced_iv)
> + return false;
what is this trying to achieve? USE_USES_INCED_IV is pretty much meaningless --
the value of USE does not depend in any way on whether it comes directly from
a PHI node or from some other calculation.
> + /* Calculate bound. */
> + bound = fold_build_plus (PLUS_EXPR, base_ptr,
> + fold_convert (sizetype, use_lt_bound));
> + if (bound == NULL_TREE)
> + return false;
How could the result be NULL_TREE?
Zdenek