This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
A problem with the loop structure
- From: "Vladimir Yanovsky" <volodyan at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Cc: "Vladimir Yanovsky" <yanov at il dot ibm dot com>, rakdver at atrey dot karlin dot mff dot cuni dot cz, pinskia at gcc dot gnu dot org
- Date: Sun, 29 Apr 2007 00:53:25 +0300
- Subject: A problem with the loop structure
Hi all,
I will greatly appreciate any suggestions regarding the following
problem I have with the loop structure. I am working on Swing Modulo
Scheduling with Sony SDK for SPU (based on gcc 4.1.1). Below there are
3 observation describing the problem.
Thanks a lot,
Vladimir
1. The problem was unveiled by compiling a testcase with dump turned
on. The compilation failed while calling function get_loop_body from
flow_loop_dump on the following assert :
else if (loop->latch != loop->header)
{
tv = dfs_enumerate_from (loop->latch, 1, glb_enum_p,
tovisit + 1, loop->num_nodes - 1,
loop->header) + 1;
gcc_assert (tv == loop->num_nodes);
The compilation exits successfully if compiled without enabling the dump.
2. SMS pass contained a single call to loop_version on the loop to be
SMSed. This happened before any SMS related stuff was done. Trying to
call verify_loop_structure(loops) just after the call to loop_version
failed on the same assert in get_loop_body as in (1). The loop on
which we fail is neither the versioned loop nor the new loop. Below
there are dumps to verify_loop_structure called from different places
in loop_version:
(gdb) n
1466 first_head = entry->dest;
(gdb) p verify_loop_structure(loops)
$12 = void
(gdb) n
1469 if (!cfg_hook_duplicate_loop_to_header_edge (loop, entry, loops, 1,
(gdb) p verify_loop_structure(loops)
$13 = void
(gdb) n
1475 second_head = entry->dest;
(gdb) p verify_loop_structure(loops)
bmark_lite.c: In function 't_run_test':
bmark_lite.c:1225: error: loop 7's header does not have exactly 2 entries
Breakpoint 1, fancy_abort (
file=0x884008 "/Develop/sony/build/toolchain/gcc/gcc/cfgloop.c", line=1277,
function=0x8841d0 "verify_loop_structure")
at /Develop/sony/build/toolchain/gcc/gcc/diagnostic.c:602
602 internal_error ("in %s, at %s:%d", function, trim_filename
(file), line);
3. At the very beginning of the SMS pass we build the loop structure
using build_loops_structure defined in modulo-sched.c. Just after the
call I tried to print in gdb the loop on which we failed in
get_loop_body. This failed as well
(gdb) p print_loop(dumpfile, 0xbabe20, 0)
No symbol "dumpfile" in current context.
(gdb) p print_loop(stdout, 0xbabe20, 0)
loop_0
{
}
$1 = void
(gdb) p print_loop(stdout, 0xd42e20, 0)
loop_7
{
bb_21 (preds = {bb_256 }, succs = {bb_23 bb_22 })
{
<L21>:;
matrixA.770 = matrixA;
temp.801 = *(matrixA.770 + (varsize * *) ivtmp.701 * 4B);
temp.874 = temp.801 + pretmp.130;
sum1_lsm.411 = *temp.874;
col1_lsm.839 = (int) ivtmp.701;
col1_lsm.837 = 0;
if (col1_lsm.839 > 0) goto <L628>; else (void) 0;
}
bb_23 (preds = {bb_21 }, succs = {bb_262 })
{
<L628>:;
ivtmp.694 = 0;
}
bb_262 (preds = {bb_23 }, succs = {bb_264 bb_263 })
{
Breakpoint 1, fancy_abort (
file=0x86e980 "/Develop/sony/build/toolchain/gcc/gcc/tree-flow-inline.h",
line=722, function=0x86e9b9 "bsi_start")
at /Develop/sony/build/toolchain/gcc/gcc/diagnostic.c:602
602 internal_error ("in %s, at %s:%d", function, trim_filename
(file), line);
The failure was on the assert in line 722(please find below):
(gdb) up
#1 0x0000000000469d80 in bsi_start (bb=0x2aaaaebc0100)
at /Develop/sony/build/toolchain/gcc/gcc/tree-flow-inline.h:722
722 gcc_assert (bb->index < 0);
(gdb) l
717 block_stmt_iterator bsi;
718 if (bb->stmt_list)
719 bsi.tsi = tsi_start (bb->stmt_list);
720 else
721 {
722 gcc_assert (bb->index < 0);
723 bsi.tsi.ptr = NULL;
724 bsi.tsi.container = NULL;
725 }
726 bsi.bb = bb;
(gdb)