------- Comment #3 from bonzini at gnu dot org 2007-02-21 16:03 ------- This unrelated patch fixes a very similar case for powerpc
unpatched: < or r0,r3,r28 < rlwinm r0,r0,0,0xff < cmpwi cr7,r0,0 < beq- cr7,L4929 patched: (r3 and r28 are both extended from QImode) > or. r0,r3,r28 > beq- cr0,L4929 With some luck, it does the same for this testcase too? It would be nice to examine why though. :-) Sorry for the lack of professionality exhibited in this comment... Index: combine.c =================================================================== --- combine.c (revision 122195) +++ combine.c (working copy) @@ -1016,6 +1016,7 @@ combine_instructions (rtx f, unsigned in #endif rtx links, nextlinks; rtx first; + basic_block prev_basic_block; int new_direct_jump_p = 0; @@ -1057,15 +1058,20 @@ combine_instructions (rtx f, unsigned in for what bits are known to be set. */ label_tick = label_tick_ebb_start = 1; + prev_basic_block = NULL; setup_incoming_promotions (first); - create_log_links (); + FOR_EACH_BB (this_basic_block) { last_call_luid = 0; mem_last_set = -1; label_tick++; + if (!single_pred_p (this_basic_block) + || single_pred (this_basic_block) != prev_basic_block) + label_tick_ebb_start = label_tick; + FOR_BB_INSNS (this_basic_block, insn) if (INSN_P (insn) && BLOCK_FOR_INSN (insn)) { @@ -1090,8 +1096,8 @@ combine_instructions (rtx f, unsigned in fprintf(dump_file, "insn_cost %d: %d\n", INSN_UID (insn), INSN_COST (insn)); } - else if (LABEL_P (insn)) - label_tick_ebb_start = label_tick; + + prev_basic_block = this_basic_block; } nonzero_sign_valid = 1; @@ -1099,6 +1105,8 @@ combine_instructions (rtx f, unsigned in /* Now scan all the insns in forward order. */ label_tick = label_tick_ebb_start = 1; + prev_basic_block = NULL; + init_reg_last (); setup_incoming_promotions (first); @@ -1107,6 +1115,10 @@ combine_instructions (rtx f, unsigned in last_call_luid = 0; mem_last_set = -1; label_tick++; + if (!single_pred_p (this_basic_block) + || single_pred (this_basic_block) != prev_basic_block) + label_tick_ebb_start = label_tick; + for (insn = BB_HEAD (this_basic_block); insn != NEXT_INSN (BB_END (this_basic_block)); insn = next ? next : NEXT_INSN (insn)) @@ -1253,9 +1265,9 @@ combine_instructions (rtx f, unsigned in retry: ; } - else if (LABEL_P (insn)) - label_tick_ebb_start = label_tick; } + + prev_basic_block = this_basic_block; } clear_log_links (); -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30904