[Patch, fortran] PR24524 - Fortran dependency checking should reverse loops

Paul Richard Thomas paul.richard.thomas@gmail.com
Thu Jun 17 18:52:00 GMT 2010


Dear Dominique,

On Thu, Jun 17, 2010 at 8:25 PM, Dominique Dhumieres <dominiq@lps.ens.fr> wrote:
> Paul,
>
> +      if (reverse_loop)
> +       {
> +         tmp = loop->from[n];
> +         loop->from[n] = loop->to[n];
> +         loop->to[n] = tmp;
> +       }
>
> Shouldn't you negate the stride here?

No,

       /* Increment the loopvar.  */
-      tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
-			 loop->loopvar[n], gfc_index_one_node);
+      tmp = fold_build2 (reverse_loop ? MINUS_EXPR : PLUS_EXPR,
+			 gfc_array_index_type, loop->loopvar[n],
+			 gfc_index_one_node);
+

Cheers

Paul


-- 
The knack of flying is learning how to throw yourself at the ground and miss.
       --Hitchhikers Guide to the Galaxy



More information about the Fortran mailing list