On Mon, 19 Jan 2015, Maxim Kuvyrkov wrote:
> The underlying problem is that the order in which elements of ready_list are
> compared matters to the final result.  This is because rank_for_schedule
> sorting heuristic establishes a partial order on the set of instructions,
> and it can happen that with 3 instructions A, B and C: A>B, B>C, C>A.  In
> this situation the order in which qsort compares the elements affects the
> final result, it can be either ABC or BCA or CAB.
> 
> Presence or absence of DEBUG_INSNs in the ready list can change the
> comparison order, and cause slightly different instruction schedules.

Could you please provide a bit more detail here?  Looking at
rank_for_schedule, I see that it considers insn pairs when at least one of
them is DEBUG_INSN, first.  Debug insns are always moved to front, sorted
within themselves by luid, and not considered in the rest of
rank_for_schedule.  I don't see how rank_for_schedule with DEBUG_INSN can
arrive at a A < B < C < A situation.

(btw, nitpicking, a "partial order" is when incomparable pairs are possible
(i.e.  none of A == B, A < B, B < A is true), a "total order" is when all
pairs are comparable, and when you can have A < B < C < A, it's not a
mathematical order relation)

Thanks.

Alexander

Reply via email to