------- Comment #3 from rguenth at gcc dot gnu dot org 2006-10-16 12:07 ------- This is a bug in loop.c
<bb 0>: pretmp.61 = q - 1; outgo = 0; <L0>:; outgo.62 = outgo + 1; outgo = MIN_EXPR <pretmp.61, outgo.62>; j = tar (outgo * bcount); if (j != -1) goto <L0>; else goto <L4>; <L4>:; return; Bug in biv selection, so strength reduction messes up: Loop from 45 to 46: 12 real insns. Biv 60: insn 19 const (reg 59 [ pretmp.26 ]) Biv 60: insn 22 const (1) Biv 60: verified Biv 60: initialized at insn 13: initial value (0) Giv 58: insn 17 src reg 60 benefit 4 lifetime 6 60 is not a Biv: (insn 19 17 20 1 (set (reg/v:SI 60 [ outgo ]) (reg:SI 59 [ pretmp.26 ])) 40 {*movsi_1} (nil) (nil)) (insn 20 19 21 1 (set (reg:CCGC 17 flags) (compare:CCGC (reg/v:SI 60 [ outgo ]) (reg/v:SI 58 [ outgo.27 ]))) 5 {*cmpsi_1_insn} (nil) (nil)) (jump_insn 21 20 41 1 (set (pc) (if_then_else (le (reg:CCGC 17 flags) (const_int 0 [0x0])) (label_ref 23) (pc))) 531 {*jcc_1} (nil) (expr_list:REG_BR_PROB (const_int 5000 [0x1388]) (nil))) ;; End of basic block 1, registers live: (nil) ;; Start of basic block 2, registers live: (nil) (note 41 21 22 2 [bb 2] NOTE_INSN_BASIC_BLOCK) (insn 22 41 23 2 (set (reg/v:SI 60 [ outgo ]) (reg/v:SI 58 [ outgo.27 ])) 40 {*movsi_1} (nil) (nil)) ;; End of basic block 2, registers live: (nil) ;; Start of basic block 3, registers live: (nil) (code_label 23 22 42 3 3 "" [1 uses]) now strength reduction does: (insn 19 17 51 1 (set (reg/v:SI 60 [ outgo ]) (reg:SI 59 [ pretmp.26 ])) -1 (nil) (nil)) (insn 51 19 20 1 (parallel [ (set (reg:SI 66) (mult:SI (reg:SI 59 [ pretmp.26 ]) (reg/v:SI 63 [ bcount ]))) (clobber (reg:CC 17 flags)) ]) -1 (nil) (nil)) (insn 20 51 21 1 (set (reg:CCGC 17 flags) (compare:CCGC (reg/v:SI 60 [ outgo ]) (reg/v:SI 58 [ outgo.27 ]))) -1 (nil) (nil)) (jump_insn 21 20 41 1 (set (pc) (if_then_else (le (reg:CCGC 17 flags) (const_int 0 [0x0])) (label_ref 23) (pc))) -1 (nil) (expr_list:REG_BR_PROB (const_int 5000 [0x1388]) (nil))) ;; End of basic block 1, registers live: (nil) ;; Start of basic block 2, registers live: (nil) (note 41 21 22 2 [bb 2] NOTE_INSN_BASIC_BLOCK) (insn 22 41 50 2 (set (reg/v:SI 60 [ outgo ]) (reg/v:SI 58 [ outgo.27 ])) -1 (nil) (nil)) (insn 50 22 23 2 (parallel [ (set (reg:SI 66) (plus:SI (reg:SI 66) (reg/v:SI 63 [ bcount ]))) (clobber (reg:CC 17 flags)) ]) -1 (nil) (nil)) ;; End of basic block 2, registers live: (nil) ;; Start of basic block 3, registers live: (nil) (code_label 23 50 42 3 3 "" [1 uses]) -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rakdver at gcc dot gnu dot | |org Last reconfirmed|2006-09-07 05:01:38 |2006-10-16 12:07:36 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28970