Le 07/07/2024 à 21:06, Harald Anlauf a écrit :
Hi Mikael,

Am 07.07.24 um 10:32 schrieb Mikael Morin:
Hello,

I have found this small cleanup lying in a local branch.
Regression-tested on x86_64-linux, OK for master?

besides the minor nit below, this is a nice cleanup!

-- 8< --

No change of behaviour, this makes a variable easier to track.

gcc/fortran/ChangeLog:

    * trans-array.cc (gfc_trans_preloop_setup): Use a separate variable
    for iteration.  Use directly the value of variable I if it is known.
    Move the definition of the variable to the branch where the
    remaining uses are.
---
  gcc/fortran/trans-array.cc | 31 +++++++++++++++++--------------
  1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 510f429ef8e..c34c97257a9 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -4294,7 +4294,6 @@ gfc_trans_preloop_setup (gfc_loopinfo * loop, int dim, int flag,
    gfc_ss *ss, *pss;
    gfc_loopinfo *ploop;
    gfc_array_ref *ar;
-  int i;

    /* This code will be executed before entering the scalarization loop
       for this dimension.  */
@@ -4340,19 +4339,10 @@ gfc_trans_preloop_setup (gfc_loopinfo * loop, int dim, int flag,
        pss = ss;
      }

-      if (dim == loop->dimen - 1)
-    i = 0;
-      else
-    i = dim + 1;
-
-      /* For the time being, there is no loop reordering.  */
-      gcc_assert (i == ploop->order[i]);
-      i = ploop->order[i];
-
        if (dim == loop->dimen - 1 && loop->parent == NULL)
      {

Strictly speaking, there should now be this assert here:

           gcc_assert (0 == ploop->order[0]);

Good point, the gfc_loopinfo::order field should probably be removed, but that's for another patch.
I'll make the change as you suggest it, thanks for the review.


Reply via email to