------- Comment #2 from abel at gcc dot gnu dot org 2009-05-15 13:20 ------- The bug happens when we compute a seqno for the newly created bookkeping insn. Seqnos exist in the algorithm (roughly) to guide the movement of fences so that, first, all unscheduled insns will be found and scheduled, and second, "dynamic" back-edges during pipelining will be properly marked.
The assert we hit just means that the existing code was unable to compute the proper seqno, because it looks only on direct succs/preds of the place we want to insert bookkeeping, yet in the test case the fences are processed in such an order that all of those succs/preds are already scheduled (we're pipelining). The fix would be to extend this code to walk further to find yet unscheduled insns and to derive the seqno from them. However, thinking about it further, I believe that we can get rid of seqnos altogether. We already have topological sorting for basic blocks in the scheduler, and it should be enough just to check that we don't hit other fence or already visited insn (or already scheduled insn if no pipelining) when computing our availability sets, and it should be enough just to move fences to unscheduled code. The original approach also used seqnos to mark parallel groups, but this is not needed for gcc. So, as we are in Stage 1, and there is no rush with this bug, I will try to get rid of seqnos first. In case it turns out I've overlooked anything, I will resort to the former, more conservative fix. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40101