This is the mail archive of the gcc-patches@gcc.gnu.org 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]

[PATCH][Modulo-sched] Add new testcase


Hello,

Vladimir traced a problem related to DFS traversal that occurred when
the header of a loop was at the same time the latch of it's outer loop -
http://gcc.gnu.org/ml/gcc/2007-06/msg00172.html. Here is snippet from
the SMS dump file showing the problematic cfg:

;; Loop 3:
;;  header 20, latch 7
;;  depth 3, level 2, outer 2
;;  nodes: 20 7 6 4
;;
;; Loop 4:
;;  header 7, latch 7
;;  depth 4, level 1, outer 3
;;  nodes: 7

He was working on GCC version based on gcc 4.1.1.

The problem was as follows: After versioning there were two edges incident
to the header of the problematic outer loop: the header of the original
loop and the header of the versioned loop.  The DFS traversal of the
outer loop began in the original loop (which is the outer loop's latch)
walking backwards and stop when the header of the outer loop was reached
(this is how the algorithm worked) so the versioned loop was not reached.

This DFS traversal was called in gcc4.1 from dump_flow_loops in
loop_optimizer_finalize at the end of the SMS driver.  In current mainline
this call does not appear; even after adding it the fail does not happen
because the DFS traversal from dump_flow_loops function is changed-
instead of beginning the traversal at the latch and walking backwards
until the header is reached; we now begins at the header and continue
as long as a maximum threshold of nodes is reached.

So, for mainline we attach the following testcase which with some tweaks
fails on gcc4.1 (ignoring the profitability check).  We also prepare a
patch for gcc4.1 with Vladimir solution for that problem. In gcc4.2 the
call to dump_flow_loops from loop_optimizer_finalize does not exist so
we do not expect this fail to happen, although the DFS traversal is as
in gcc4.1.

OK for mainline?

Thanks,
Tehila and Revital

:ADDPATCH middle-end (modulo-sched):

ChangeLog:

* testsuite/gcc.dg/sms-2.c: New testcase.

(See attached file: patch_testcase_sms.txt)

Attachment: patch_testcase_sms.txt
Description: Text document


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