This is the mail archive of the 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]

Re: About standard_iv_increment_position


> I was trying to make the code for unifying wrap around variables to
> work on some spec programs, and I've seen that the reason it is
> failing is because I insert the increment of the new IV at the wrong
> place.
> Then I've seen that there is a function standard_iv_increment_position
> that is supposed to return the right position for inserting the new IV.  
> The first remark is that this function is not used in mainline nor in
> autovect.  It seems to me that the arguments of create_iv should be
> computed using standard_iv_increment_position, thus some cleanup
> changes should be considered to tree-loop-linear.c and to
> tree-vectorizer.c.

this indeed might be a good idea.

> The second remark is that standard_iv_increment_position will return a
> block_stmt_iterator and a position that is invalid for verify_flow_info, 
> as shown in the following case that fails:
>       if (_n_413 < N_60) goto <L5>; else goto <L23>;
>       ivtmp.1076_499 = ivtmp.1076_498 + 1;

I don't think this can ever happen.  The piece of code your patch
changes is only executed with bsi in latch block.  Latch block always
has precisely one successor, and therefore it cannot end with
conditional expression.

This reasoning is a bit fragile, so the following might be better

  *insert_after = !last || !stmt_ends_bb_p (last);

(your patch is wrong, you might end up inserting code before


> Here, the IV update is inserted after the jump.  I propose the
> following patch for correcting this behavior:

> Index: tree-ssa-loop-manip.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-manip.c,v
> retrieving revision 2.21
> diff -d -u -p -r2.21 tree-ssa-loop-manip.c
> --- tree-ssa-loop-manip.c	29 Nov 2004 17:53:47 -0000	2.21
> +++ tree-ssa-loop-manip.c	28 Jan 2005 13:48:11 -0000
> @@ -504,7 +504,7 @@ standard_iv_increment_position (struct l
>        || (last && TREE_CODE (last) != LABEL_EXPR))
>      {
>        *bsi = bsi_last (latch);
> -      *insert_after = true;
> +      *insert_after = false;
>      }
>    else
>      {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]