aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/dependency.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2011-05-26 18:19:36 +0000
committerPaul Thomas <pault@gcc.gnu.org>2011-05-26 18:19:36 +0000
commitaed5574e7b576594b71bbda5c822c667055b791c (patch)
treeffed11dce78ea1dd3b66ef042c7218e1fa25507e /gcc/fortran/dependency.c
parentb8ff4e88e790df436088012ce6db7f7d3b6c1514 (diff)
downloadgcc-aed5574e7b576594b71bbda5c822c667055b791c.zip
gcc-aed5574e7b576594b71bbda5c822c667055b791c.tar.gz
gcc-aed5574e7b576594b71bbda5c822c667055b791c.tar.bz2
[multiple changes]
2011-05-26 Paul Thomas <pault@gcc.gnu.org> Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/48955 * trans-expr.c (gfc_trans_assignment_1): GFC_REVERSE_NOT_SET changed to GFC_ENABLE_REVERSE. * trans-array.c (gfc_init_loopinfo): GFC_CANNOT_REVERSE changed to GFC_INHIBIT_REVERSE. * gfortran.h : Enum gfc_reverse is now GFC_ENABLE_REVERSE, GFC_FORWARD_SET, GFC_REVERSE_SET and GFC_INHIBIT_REVERSE. * dependency.c (gfc_dep_resolver): Change names for elements of gfc_reverse as necessary. Change the logic so that forward dependences are remembered as well as backward ones. When both have appeared, force a temporary. 2011-05-26 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/48955 * gfortran.dg/dependency_40.f90 : New test. From-SVN: r174302
Diffstat (limited to 'gcc/fortran/dependency.c')
-rw-r--r--gcc/fortran/dependency.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c
index d237a92..cb5d10c 100644
--- a/gcc/fortran/dependency.c
+++ b/gcc/fortran/dependency.c
@@ -1807,7 +1807,7 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse)
/* Now deal with the loop reversal logic: This only works on
ranges and is activated by setting
- reverse[n] == GFC_CAN_REVERSE
+ reverse[n] == GFC_ENABLE_REVERSE
The ability to reverse or not is set by previous conditions
in this dimension. If reversal is not activated, the
value GFC_DEP_BACKWARD is reset to GFC_DEP_OVERLAP. */
@@ -1815,25 +1815,34 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse)
&& lref->u.ar.dimen_type[n] == DIMEN_RANGE)
{
/* Set reverse if backward dependence and not inhibited. */
- if (reverse && reverse[n] != GFC_CANNOT_REVERSE)
+ if (reverse && reverse[n] == GFC_ENABLE_REVERSE)
reverse[n] = (this_dep == GFC_DEP_BACKWARD) ?
GFC_REVERSE_SET : reverse[n];
- /* Inhibit loop reversal if dependence not compatible. */
- if (reverse && reverse[n] != GFC_REVERSE_NOT_SET
- && this_dep != GFC_DEP_EQUAL
- && this_dep != GFC_DEP_BACKWARD
- && this_dep != GFC_DEP_NODEP)
+ /* Set forward if forward dependence and not inhibited. */
+ if (reverse && reverse[n] == GFC_ENABLE_REVERSE)
+ reverse[n] = (this_dep == GFC_DEP_FORWARD) ?
+ GFC_FORWARD_SET : reverse[n];
+
+ /* Flag up overlap if dependence not compatible with
+ the overall state of the expression. */
+ if (reverse && reverse[n] == GFC_REVERSE_SET
+ && this_dep == GFC_DEP_FORWARD)
+ {
+ reverse[n] = GFC_INHIBIT_REVERSE;
+ this_dep = GFC_DEP_OVERLAP;
+ }
+ else if (reverse && reverse[n] == GFC_FORWARD_SET
+ && this_dep == GFC_DEP_BACKWARD)
{
- reverse[n] = GFC_CANNOT_REVERSE;
- if (this_dep != GFC_DEP_FORWARD)
- this_dep = GFC_DEP_OVERLAP;
+ reverse[n] = GFC_INHIBIT_REVERSE;
+ this_dep = GFC_DEP_OVERLAP;
}
/* If no intention of reversing or reversing is explicitly
inhibited, convert backward dependence to overlap. */
- if (this_dep == GFC_DEP_BACKWARD
- && (reverse == NULL || reverse[n] == GFC_CANNOT_REVERSE))
+ if ((reverse == NULL && this_dep == GFC_DEP_BACKWARD)
+ || (reverse != NULL && reverse[n] == GFC_INHIBIT_REVERSE))
this_dep = GFC_DEP_OVERLAP;
}