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]

[RFC] [PATCH] [modulo-sched] fix handling of anti-dependences

This patch addresses the second item on
The modulo-scheduler may violate anti-dependences when scheduling both
the source and the sink of the dependence in the same cycle. This can
occur when we have two or more defs of the same register, and the last
use of the register is scheduled II cycles after the first def (it
cannot be scheduled later than that because of a dependence arc), so
both are assigned to the same row, but possibly in the wrong order.
Note also that for a single def and it's uses this problem does not
arise, as register moves are used to handle live-ranges exceeding II
cycles. We have a patch to preserve the correct order for such cases.
The problem came up in the gcc testsuite - in the testcase loop-3c.c.
Another solution that solved the problem (for that testcase) was to
schedule a web pass before SMS (which eliminated the dependence by not
defining the same register twice), but we didn't pursue this

The patch is not submitted yet for inclusion, just for comments (will
be submitted for inclusion as soon as the SPU port is in, and
retesting with updated mainline is done).




Index: modulo-sched.c =================================================================== --- modulo-sched.c (revision 623) +++ modulo-sched.c (working copy) @@ -1600,14 +1623,16 @@ sbitmap_zero (must_follow); for (e = u_node->in; e != 0; e = e->next_in) if (TEST_BIT (sched_nodes, e->src->cuid) - && e->latency == (ii * e->distance) - && start == SCHED_TIME (e->src)) + && (e->latency == (ii * e->distance) + && start == SCHED_TIME (e->src)) + || (e->type != TRUE_DEP)) SET_BIT (must_precede, e->src->cuid);

         for (e = u_node->out; e != 0; e = e->next_out)
            if (TEST_BIT (sched_nodes, e->dest->cuid)
-               && e->latency == (ii * e->distance)
-               && end == SCHED_TIME (e->dest))
+               && (e->latency == (ii * e->distance)
+                    && start == SCHED_TIME (e->src))
+                 || (e->type != TRUE_DEP))
             SET_BIT (must_follow, e->dest->cuid);

success = 0;

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