http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56023
--- Comment #5 from Uros Bizjak <ubizjak at gmail dot com> 2013-01-18 17:38:23 UTC --- Bookkeeping seems somehow broken to me in sched1 pass: -O2 -fcompare-debug -fdump-rtl-sched1-slim -S: _.c.190r.sched1: ;; ====================================================== ;; -- basic block 5 from 48 to 49 -- before reload ;; ====================================================== changing bb of uid 64 from 8 to 5 ;; 0--> 64 r137=zxn(r76#0) ;; 1--> 48 r111=r90==0x20 changing bb of uid 65 from 8 to 5 ;; 2--> 65 r119=r95+r137 ;; 2--> 49 pc={(r111==0)?L59:pc} ;; Ready list (final): ;; total time = 2 ;; new head = 48 ;; new tail = 49 New head is 64, *not* 48. And here comes the difference: _.c.190r.sched1: ;; ====================================================== ;; -- basic block 10 from 94 to 94 -- before reload ;; ====================================================== changing bb of uid 25 from 4 to 10 ;; 1--> 25 r100=zxn(r75#0) ;; 1--> 94 pc={(r90!=0)?L93:pc} ;; Ready list (final): 39/b6:18 37/b6:17 ;; total time = 1 ;; new head = 94 ;; new tail = 94 Again wrong head w/o -g. _.c.gk.190r.sched1 ;; ====================================================== ;; -- basic block 10 from 99 to 102 -- before reload ;; ====================================================== ;; 0--> 99: debug i => r76#0 ;; 0--> 100: debug x => r75#0 changing bb of uid 29 from 4 to 10 ;; 1--> 29 r100=zxn(r75#0) ;; 1--> 102 pc={(r90!=0)?L101:pc} ;; Ready list (final): 43/b6:20 41/b6:19 ;; total time = 1 ;; new head = 99 ;; new tail = 102 Here we account debug instructions as head. I suspect that this is the cause of the difference in a follow-up block, where we schedule in a different ways: _.c.190r.sched1: ;; ====================================================== ;; -- basic block 4 from 26 to 40 -- before reload ;; ====================================================== ;; 1--> 26 r102=r100==0x1 ;; 2--> 31 r105=ltu(r138,r137) ;; 3--> 27 r101=r102==0 ;; 4--> 37 r92=sxn(r92#0+0x1) ;; 5--> 35 r79=r101&r105 ;; 6--> 39 r76=sxn(r76#0+0x1) ;; 6--> 40 pc={(r79!=0)?L97:pc} _.c.gk.190r.sched1 ;; ====================================================== ;; -- basic block 4 from 30 to 44 -- before reload ;; ====================================================== ;; 0--> 43 r76=sxn(r76#0+0x1) ;; 1--> 30 r102=r100==0x1 ;; 2--> 35 r105=ltu(r138,r137) ;; 3--> 31 r101=r102==0 ;; 4--> 41 r92=sxn(r92#0+0x1) ;; 5--> 39 r79=r101&r105 ;; 6--> 44 pc={(r79!=0)?L105:pc} In the later dump, (insn 43) was scheduled above all others.