On 11/6/20 2:37 AM, Jojo R wrote: > Insn seqs before sched: > > .L1: > a5 = insn-1 (a0) > a6 = insn-2 (a1) > a7 = insn-3 (a7, a5) > a8 = insn-4 (a8, a6) > Jmp .L1 > > Insn-3 & insn-4 is REG_DEP_TRUE of insn-1 & insn-2, > so insn-3 & insn-4 will be as the last of ready list. > And this patch will put 0 cost dependency due to a bypass > as highest numbered class also if some target have forward > feature between DEP_PRO and DEP_CON. > > if the insns are in the same cost class on -fsched-last-insn-heuristic, > And then, go to "prefer the insn which has more later insns that depend on > it", > return from dep_list_size() is not satisfied, it includes all dependence of > insn. > We need to ignore the ones that have a 0 cost dependency due to a bypass. > > With this patch and pipeline description as below: > > (define_bypass 0 "insn-1, insn-2" "insn-3, insn-4") > > We can get better insn seqs after sched: > > .L1: > a5 = insn-1 (a0) > a7 = insn-3 (a7, a5) > a6 = insn-2 (a1) > a8 = insn-4 (a8, a6) > Jmp .L1 > > I have tested on ck860 of C-SKY arch and C960 of T-Head based on RISCV arch > > gcc/ > * haifa-sched.c (dep_list_costs): New. > (rank_for_schedule): Replace dep_list_size with dep_list_costs. > Add 0 cost dependency due to bypass on -fsched-last-insn-heuristic.
OK for the trunk. Thanks, Jeff