Index: auto-inc-dec.c =================================================================== --- auto-inc-dec.c (revision 118551) +++ auto-inc-dec.c (working copy) @@ -450,7 +450,6 @@ static rtx * reg_next_use = NULL; static rtx * reg_next_inc_use = NULL; static rtx * reg_next_def = NULL; static struct df *df = NULL; -static struct dataflow *scan_dflow = NULL; /* Move notes that match PATTERN to TO_INSN from FROM_INSN. If @@ -607,7 +606,8 @@ attempt_change (rtx new_addr_pat, rtx in regno = REGNO (inc_insn.reg0); reg_next_use [regno] = mem_insn.insn; - if (reg_next_use [regno] == reg_next_inc_use[regno]) + if ((reg_next_use [regno] == reg_next_inc_use[regno]) + || (reg_next_inc_use[regno] == inc_insn.insn)) reg_next_inc_use[regno] = NULL; break; @@ -619,20 +619,19 @@ attempt_change (rtx new_addr_pat, rtx in { regno = REGNO (inc_insn.reg1); reg_next_use [regno] = mem_insn.insn; + if ((reg_next_use [regno] == reg_next_inc_use[regno]) + || (reg_next_inc_use[regno] == inc_insn.insn)) + reg_next_inc_use[regno] = NULL; } /* Recompute the df info for the insns that have changed. */ delete_insn (inc_insn.insn); df_insn_rescan (mem_insn.insn); - if (mov_insn) + if (dump_file && mov_insn) { - if (dump_file) - { - fprintf (dump_file, "inserting mov "); - dump_insn_slim (dump_file, mov_insn); - } - df_insn_rescan (scan_dflow, mov_insn); + fprintf (dump_file, "inserting mov "); + dump_insn_slim (dump_file, mov_insn); } df_recompute_luids (df, bb); @@ -1098,11 +1097,11 @@ find_inc (bool first_try) = get_next_ref (REGNO (inc_insn.reg1), bb, reg_next_use); if (other_insn && luid > DF_INSN_LUID (df, other_insn)) return false; - + if (!rtx_equal_p (mem_insn.reg0, inc_insn.reg0)) reverse_inc (); } - + other_insn = get_next_ref (REGNO (inc_insn.reg1), bb, reg_next_def); if (other_insn && luid > DF_INSN_LUID (df, other_insn)) @@ -1331,6 +1330,9 @@ merge_in_block (int max_reg, basic_block struct df_ref *use; int success_in_block = 0; + if (dump_file) + fprintf (dump_file, "\n\nstarting bb %d\n", bb->index); + FOR_BB_INSNS_REVERSE_SAFE (bb, insn, curr) { unsigned int uid = INSN_UID (insn); @@ -1407,21 +1409,28 @@ merge_in_block (int max_reg, basic_block success_in_block++; } - /* Need to update next use. */ - for (def = DF_INSN_UID_DEFS (df, uid); def; def = def->next_ref) + /* If the inc insn was merged with a mem, the inc insn is gone + and there is noting to update. */ + if (DF_INSN_UID_GET(df, uid)) { - reg_next_use[DF_REF_REGNO (def)] = NULL; - reg_next_inc_use[DF_REF_REGNO (def)] = NULL; - reg_next_def[DF_REF_REGNO (def)] = insn; + /* Need to update next use. */ + for (def = DF_INSN_UID_DEFS (df, uid); def; def = def->next_ref) + { + reg_next_use[DF_REF_REGNO (def)] = NULL; + reg_next_inc_use[DF_REF_REGNO (def)] = NULL; + reg_next_def[DF_REF_REGNO (def)] = insn; + } + + for (use = DF_INSN_UID_USES (df, uid); use; use = use->next_ref) + { + reg_next_use[DF_REF_REGNO (use)] = insn; + reg_next_use[DF_REF_REGNO (use)] = insn; + if (insn_is_add_or_inc) + reg_next_inc_use[DF_REF_REGNO (use)] = insn; + } } - - for (use = DF_INSN_UID_USES (df, uid); use; use = use->next_ref) - { - reg_next_use[DF_REF_REGNO (use)] = insn; - reg_next_use[DF_REF_REGNO (use)] = insn; - if (insn_is_add_or_inc) - reg_next_inc_use[DF_REF_REGNO (use)] = insn; - } + else if (dump_file) + fprintf (dump_file, "skipping update of deleted insn %d\n", uid); } /* If we were successful, try again. There may have been several @@ -1455,7 +1464,6 @@ rest_of_handle_auto_inc_dec (void) df = df_init (0, 0); df_live_add_problem (df); df_ri_add_problem (df); - scan_dflow = df->problems_by_index[DF_SCAN]; df_analyze (df); reg_next_use = XCNEWVEC (rtx, max_reg); Index: df-scan.c =================================================================== --- df-scan.c (revision 118551) +++ df-scan.c (working copy) @@ -247,16 +247,15 @@ df_scan_free_bb_info (struct dataflow *d called when the problem is created or when the entire function is to be rescanned. */ -static void -df_scan_alloc (struct dataflow *dflow, bitmap blocks_to_rescan, +void +df_scan_alloc (struct dataflow *dflow, bitmap blocks_to_rescan ATTRIBUTE_UNUSED, bitmap all_blocks ATTRIBUTE_UNUSED) { struct df *df = dflow->df; struct df_scan_problem_data *problem_data; unsigned int insn_num = get_max_uid () + 1; unsigned int block_size = 50; - unsigned int bb_index; - bitmap_iterator bi; + basic_block bb; /* Given the number of pools, this is really faster than tearing everything apart. */ @@ -296,8 +295,9 @@ df_scan_alloc (struct dataflow *dflow, b df_grow_insn_info (df); df_grow_bb_info (dflow); - EXECUTE_IF_SET_IN_BITMAP (blocks_to_rescan, 0, bb_index, bi) + FOR_ALL_BB (bb) { + unsigned int bb_index = bb->index; struct df_scan_bb_info *bb_info = df_scan_get_bb_info (dflow, bb_index); if (!bb_info) { @@ -327,9 +327,6 @@ df_scan_free (struct dataflow *dflow) if (dflow->problem_data) df_scan_free_internal (dflow); - if (df->blocks_to_scan) - BITMAP_FREE (df->blocks_to_scan); - if (df->blocks_to_analyze) BITMAP_FREE (df->blocks_to_analyze); @@ -538,11 +535,11 @@ df_grow_insn_info (struct df *df) PUBLIC INTERFACES FOR SMALL GRAIN CHANGES TO SCANNING. ----------------------------------------------------------------------------*/ -/* Rescan some BLOCKS or all the blocks defined by the last call to - df_set_blocks if BLOCKS is NULL); */ +/* Rescan all of the block_to_analyze or all of the blocks in the + function if df_set_blocks if blocks_to_analyze is NULL; */ void -df_scan_blocks (struct df *df, bitmap blocks) +df_scan_blocks (struct df *df) { bitmap local_blocks_to_scan = BITMAP_ALLOC (NULL); @@ -554,102 +551,21 @@ df_scan_blocks (struct df *df, bitmap bl df->use_info.refs_organized_with_eq_uses = false; df->use_info.refs_organized_alone = false; - if (blocks) - { - int i; - unsigned int bb_index; - bitmap_iterator bi; - bool cleared_bits = false; - - /* Need to assure that there are space in all of the tables. */ - unsigned int insn_num = get_max_uid () + 1; - insn_num += insn_num / 4; - - df_grow_reg_info (dflow); - - df_grow_ref_info (&df->def_info, insn_num); - df_grow_ref_info (&df->use_info, insn_num *2); - - df_grow_insn_info (df); - df_grow_bb_info (dflow); - - bitmap_copy (local_blocks_to_scan, blocks); - - EXECUTE_IF_SET_IN_BITMAP (blocks, 0, bb_index, bi) - { - basic_block bb = BASIC_BLOCK (bb_index); - if (!bb) - { - bitmap_clear_bit (local_blocks_to_scan, bb_index); - cleared_bits = true; - } - } - - if (cleared_bits) - bitmap_copy (blocks, local_blocks_to_scan); - - df->def_info.add_refs_inline = true; - df->use_info.add_refs_inline = true; - - for (i = df->num_problems_defined; i; i--) - { - bitmap blocks_to_reset = NULL; - if (dflow->problem->reset_fun) - { - if (!blocks_to_reset) - { - blocks_to_reset = BITMAP_ALLOC (NULL); - bitmap_copy (blocks_to_reset, local_blocks_to_scan); - if (df->blocks_to_scan) - bitmap_ior_into (blocks_to_reset, df->blocks_to_scan); - } - dflow->problem->reset_fun (dflow, blocks_to_reset); - } - if (blocks_to_reset) - BITMAP_FREE (blocks_to_reset); - } - - EXECUTE_IF_SET_IN_BITMAP (local_blocks_to_scan, 0, bb_index, bi) - { - df_bb_delete (bb_index); - } - - /* This may be a mistake, but if an explicit blocks is passed in - and the set of blocks to analyze has been explicitly set, add - the extra blocks to blocks_to_analyze. The alternative is to - put an assert here. We do not want this to just go by - silently or else we may get storage leaks. */ - if (df->blocks_to_analyze) - bitmap_ior_into (df->blocks_to_analyze, blocks); - } + /* If we are going to do everything, just reallocate everything. + Most stuff is allocated in pools so this is faster than + walking it. */ + if (df->blocks_to_analyze) + bitmap_copy (local_blocks_to_scan, df->blocks_to_analyze); else - { - /* If we are going to do everything, just reallocate everything. - Most stuff is allocated in pools so this is faster than - walking it. */ - if (df->blocks_to_analyze) - bitmap_copy (local_blocks_to_scan, df->blocks_to_analyze); - else - FOR_ALL_BB (bb) - { - bitmap_set_bit (local_blocks_to_scan, bb->index); - } - df_scan_alloc (dflow, local_blocks_to_scan, NULL); - - df->def_info.add_refs_inline = false; - df->use_info.add_refs_inline = false; - } + FOR_ALL_BB (bb) + { + bitmap_set_bit (local_blocks_to_scan, bb->index); + } + df->def_info.add_refs_inline = false; + df->use_info.add_refs_inline = false; df_refs_record (dflow, local_blocks_to_scan); -#if 0 - bitmap_print (stderr, local_blocks_to_scan, "scanning: ", "\n"); -#endif - - if (!df->blocks_to_scan) - df->blocks_to_scan = BITMAP_ALLOC (NULL); - - bitmap_ior_into (df->blocks_to_scan, local_blocks_to_scan); BITMAP_FREE (local_blocks_to_scan); } @@ -1033,7 +949,7 @@ df_insn_rescan (rtx insn) /* End of really bad code. */ if (changed) - df_mark_bb_dirty (bb); + df_set_bb_dirty (bb); return changed; } @@ -1167,8 +1083,8 @@ df_insn_change_bb (rtx insn) if (changed) { if (old_bb) - df_mark_bb_dirty (old_bb); - df_mark_bb_dirty (new_bb); + df_set_bb_dirty (old_bb); + df_set_bb_dirty (new_bb); } } Index: df.h =================================================================== --- df.h (revision 118551) +++ df.h (working copy) @@ -389,12 +389,6 @@ struct df struct dataflow *problems_by_index [DF_LAST_PROBLEM_PLUS1]; int num_problems_defined; - /* Set after calls to df_scan_blocks, this contains all of the - blocks that higher level problems must rescan before solving the - dataflow equations. If this is NULL, the blocks_to_analyze is - used. */ - bitmap blocks_to_scan; - /* If not NULL, the subset of blocks of the program to be considered for analysis. */ bitmap blocks_to_analyze; @@ -689,7 +683,8 @@ extern void df_simple_iterative_dataflow df_confluence_function_0, df_confluence_function_n, df_transfer_function, bitmap, int *, int); extern void df_mark_solutions_dirty (struct df *); -extern void df_mark_bb_dirty (basic_block); +extern bool df_get_bb_dirty (basic_block); +extern void df_set_bb_dirty (basic_block); extern void df_compact_blocks (void); extern void df_bb_replace (int, basic_block); extern struct df_ref *df_bb_regno_last_use_find (struct df *, basic_block, unsigned int); @@ -756,9 +751,10 @@ extern void df_urec_get_live_at_top (str /* Functions defined in df-scan.c. */ +extern void df_scan_alloc (struct dataflow *, bitmap, bitmap); extern struct df_scan_bb_info *df_scan_get_bb_info (struct dataflow *, unsigned int); extern struct dataflow *df_scan_add_problem (struct df *); -extern void df_scan_blocks (struct df *, bitmap); +extern void df_scan_blocks (struct df *); extern struct df_ref *df_ref_create (struct df *, rtx, rtx *, rtx,basic_block,enum df_ref_type, enum df_ref_flags); extern struct df_ref *df_get_artificial_defs (struct df *, unsigned int); extern struct df_ref *df_get_artificial_uses (struct df *, unsigned int); Index: df-core.c =================================================================== --- df-core.c (revision 118551) +++ df-core.c (working copy) @@ -49,7 +49,7 @@ Here is an example of using the dataflow df_set_blocks (df, blocks); - df_scan_blocks (df, blocks); + df_scan_blocks (df); df_analyze (df); @@ -850,7 +850,10 @@ df_analyze (struct df *df) bitmap current_all_blocks = BITMAP_ALLOC (NULL); int i; bool everything; - + struct dataflow *scan_dflow = df->problems_by_index[DF_SCAN]; + + df_scan_alloc (scan_dflow, NULL, NULL); + if (df->postorder) free (df->postorder); df->postorder = XNEWVEC (int, last_basic_block); @@ -860,13 +863,10 @@ df_analyze (struct df *df) bitmap_set_bit (current_all_blocks, df->postorder[i]); /* No one called df_scan_blocks, so do it. */ - if (!df->blocks_to_scan) - df_scan_blocks (df, NULL); + df_scan_blocks (df); /* Make sure that we have pruned any unreachable blocks from these sets. */ - bitmap_and_into (df->blocks_to_scan, current_all_blocks); - if (df->blocks_to_analyze) { everything = false; @@ -886,17 +886,20 @@ df_analyze (struct df *df) for (i = 1; i < df->num_problems_defined; i++) df_analyze_problem (df->problems_in_order[i], df->blocks_to_analyze, df->blocks_to_analyze, - df->blocks_to_scan, + df->blocks_to_analyze, df->postorder, df->n_blocks, false); if (everything) { BITMAP_FREE (df->blocks_to_analyze); df->blocks_to_analyze = NULL; + bitmap_clear (df->out_of_date_transfer_functions); } + else + bitmap_and_compl_into (df->out_of_date_transfer_functions, + df->blocks_to_analyze); - BITMAP_FREE (df->blocks_to_scan); - df->blocks_to_scan = NULL; + df->solutions_dirty = false; } @@ -988,16 +991,31 @@ df_mark_solutions_dirty (struct df *df) } +/* Return true if BB needs it's transfer functions recomputed. */ + +bool +df_get_bb_dirty (basic_block bb) +{ + struct df *df = df_current_instance; + if (df) + return bitmap_bit_p (df->out_of_date_transfer_functions, bb->index); + else + return false; +} + + /* Mark BB as needing it's transfer functions as being out of date. */ void -df_mark_bb_dirty (basic_block bb) +df_set_bb_dirty (basic_block bb) { struct df *df = df_current_instance; - - df_mark_solutions_dirty (df); - bitmap_set_bit (df->out_of_date_transfer_functions, bb->index); + if (df) + { + df_mark_solutions_dirty (df); + bitmap_set_bit (df->out_of_date_transfer_functions, bb->index); + } } @@ -1050,19 +1068,6 @@ df_compact_blocks (void) /* Shuffle the bits in the basic_block indexed arrays. */ - if (df->blocks_to_scan) - { - bitmap_copy (tmp, df->blocks_to_scan); - bitmap_clear (df->blocks_to_scan); - i = NUM_FIXED_BLOCKS; - FOR_EACH_BB (bb) - { - if (bitmap_bit_p (tmp, bb->index)) - bitmap_set_bit (df->blocks_to_scan, i); - i++; - } - } - bitmap_copy (tmp, df->out_of_date_transfer_functions); bitmap_clear (df->out_of_date_transfer_functions); i = NUM_FIXED_BLOCKS; @@ -1112,29 +1117,28 @@ void df_bb_replace (int old_index, basic_block new_block) { struct df *df = df_current_instance; + int new_block_index = new_block->index; int p; + gcc_assert (df); + gcc_assert (BASIC_BLOCK (old_index) == NULL); for (p = 0; p < df->num_problems_defined; p++) { struct dataflow *dflow = df->problems_in_order[p]; if (dflow->block_info) { - void *temp; - df_grow_bb_info (dflow); - - /* The old switcheroo. */ - - temp = df_get_bb_info (dflow, old_index); + gcc_assert (df_get_bb_info (dflow, old_index) == NULL); df_set_bb_info (dflow, old_index, - df_get_bb_info (dflow, new_block->index)); - df_set_bb_info (dflow, new_block->index, temp); + df_get_bb_info (dflow, new_block_index)); } } SET_BASIC_BLOCK (old_index, new_block); + df_set_bb_dirty (BASIC_BLOCK (old_index)); new_block->index = old_index; + SET_BASIC_BLOCK (new_block_index, NULL); } Index: ifcvt.c =================================================================== --- ifcvt.c (revision 118551) +++ ifcvt.c (working copy) @@ -92,18 +92,18 @@ static rtx last_active_insn (basic_block static basic_block block_fallthru (basic_block); static int cond_exec_process_insns (ce_if_block_t *, rtx, rtx, rtx, rtx, int); static rtx cond_exec_get_condition (rtx); -static int cond_exec_process_if_block (bitmap, ce_if_block_t *, int); +static int cond_exec_process_if_block (ce_if_block_t *, int); static rtx noce_get_condition (rtx, rtx *); static int noce_operand_ok (rtx); -static int noce_process_if_block (bitmap, ce_if_block_t *); -static int process_if_block (bitmap, ce_if_block_t *); -static void merge_if_block (bitmap, ce_if_block_t *); -static int find_cond_trap (bitmap, basic_block, edge, edge); -static basic_block find_if_header (struct df *, bitmap, basic_block, int); +static int noce_process_if_block (ce_if_block_t *); +static int process_if_block (ce_if_block_t *); +static void merge_if_block (ce_if_block_t *); +static int find_cond_trap (basic_block, edge, edge); +static basic_block find_if_header (struct df *, basic_block, int); static int block_jumps_and_fallthru_p (basic_block, basic_block); -static int find_if_block (bitmap, ce_if_block_t *); -static int find_if_case_1 (struct df *, bitmap, basic_block, edge, edge); -static int find_if_case_2 (struct df *, bitmap, basic_block, edge, edge); +static int find_if_block (ce_if_block_t *); +static int find_if_case_1 (struct df *, basic_block, edge, edge); +static int find_if_case_2 (struct df *, basic_block, edge, edge); static int find_memory (rtx *, void *); static int dead_or_predicable (struct df *, basic_block, basic_block, basic_block, basic_block, int); @@ -369,8 +369,7 @@ cond_exec_get_condition (rtx jump) converting the block. */ static int -cond_exec_process_if_block (bitmap modified, - ce_if_block_t * ce_info, +cond_exec_process_if_block (ce_if_block_t * ce_info, /* if block information */int do_multiple_p) { basic_block test_bb = ce_info->test_bb; /* last test block */ @@ -573,7 +572,7 @@ cond_exec_process_if_block (bitmap modif n_insns, (n_insns == 1) ? " was" : "s were"); /* Merge the blocks! */ - merge_if_block (modified, ce_info); + merge_if_block (ce_info); cond_exec_changed_p = TRUE; return TRUE; @@ -2166,7 +2165,7 @@ noce_mem_write_may_trap_or_fault_p (rtx successful at converting the block. */ static int -noce_process_if_block (bitmap modified, struct ce_if_block * ce_info) +noce_process_if_block (struct ce_if_block * ce_info) { basic_block test_bb = ce_info->test_bb; /* test block */ basic_block then_bb = ce_info->then_bb; /* THEN */ @@ -2393,7 +2392,7 @@ noce_process_if_block (bitmap modified, } /* Merge the blocks! */ - merge_if_block (modified, ce_info); + merge_if_block (ce_info); return TRUE; } @@ -2469,8 +2468,7 @@ check_cond_move_block (basic_block bb, r converting the block. */ static int -cond_move_process_if_block (bitmap modified, - struct ce_if_block *ce_info) +cond_move_process_if_block (struct ce_if_block *ce_info) { basic_block then_bb = ce_info->then_bb; basic_block else_bb = ce_info->else_bb; @@ -2631,7 +2629,7 @@ cond_move_process_if_block (bitmap modif } delete_insn (jump); - merge_if_block (modified, ce_info); + merge_if_block (ce_info); return TRUE; } @@ -2640,14 +2638,14 @@ cond_move_process_if_block (bitmap modif straight line code. Return true if successful. */ static int -process_if_block (bitmap modified, struct ce_if_block * ce_info) +process_if_block (struct ce_if_block * ce_info) { if (! reload_completed - && noce_process_if_block (modified, ce_info)) + && noce_process_if_block (ce_info)) return TRUE; if (HAVE_conditional_move - && cond_move_process_if_block (modified, ce_info)) + && cond_move_process_if_block (ce_info)) return TRUE; if (HAVE_conditional_execution && reload_completed) @@ -2656,14 +2654,14 @@ process_if_block (bitmap modified, struc || tests into the conditional code, and if that fails, go back and handle it without the && and ||, which at present handles the && case if there was no ELSE block. */ - if (cond_exec_process_if_block (modified, ce_info, TRUE)) + if (cond_exec_process_if_block (ce_info, TRUE)) return TRUE; if (ce_info->num_multiple_test_blocks) { cancel_changes (0); - if (cond_exec_process_if_block (modified, ce_info, FALSE)) + if (cond_exec_process_if_block (ce_info, FALSE)) return TRUE; } } @@ -2674,7 +2672,7 @@ process_if_block (bitmap modified, struc /* Merge the blocks and mark for local life update. */ static void -merge_if_block (bitmap modified, struct ce_if_block * ce_info) +merge_if_block (struct ce_if_block * ce_info) { basic_block test_bb = ce_info->test_bb; /* last test block */ basic_block then_bb = ce_info->then_bb; /* THEN */ @@ -2685,7 +2683,7 @@ merge_if_block (bitmap modified, struct /* All block merging is done into the lower block numbers. */ combo_bb = test_bb; - bitmap_set_bit (modified, test_bb->index); + df_set_bb_dirty (test_bb); /* Merge any basic blocks to handle && and || subtests. Each of the blocks are on the fallthru path from the predecessor block. */ @@ -2788,7 +2786,7 @@ merge_if_block (bitmap modified, struct first block if some transformation was done. Return NULL otherwise. */ static basic_block -find_if_header (struct df *df, bitmap modified, basic_block test_bb, int pass) +find_if_header (struct df *df, basic_block test_bb, int pass) { ce_if_block_t ce_info; edge then_edge; @@ -2801,9 +2799,9 @@ find_if_header (struct df *df, bitmap mo then_edge = EDGE_SUCC (test_bb, 0); else_edge = EDGE_SUCC (test_bb, 1); - if (bitmap_bit_p (modified, then_edge->dest->index)) + if (df_get_bb_dirty (then_edge->dest)) return NULL; - if (bitmap_bit_p (modified, else_edge->dest->index)) + if (df_get_bb_dirty (else_edge->dest)) return NULL; /* Neither edge should be abnormal. */ @@ -2839,19 +2837,19 @@ find_if_header (struct df *df, bitmap mo IFCVT_INIT_EXTRA_FIELDS (&ce_info); #endif - if (find_if_block (modified, &ce_info)) + if (find_if_block (&ce_info)) goto success; if (HAVE_trap && HAVE_conditional_trap - && find_cond_trap (modified, test_bb, then_edge, else_edge)) + && find_cond_trap (test_bb, then_edge, else_edge)) goto success; if (dom_computed[CDI_POST_DOMINATORS] >= DOM_NO_FAST_QUERY && (! HAVE_conditional_execution || reload_completed)) { - if (find_if_case_1 (df, modified, test_bb, then_edge, else_edge)) + if (find_if_case_1 (df, test_bb, then_edge, else_edge)) goto success; - if (find_if_case_2 (df, modified, test_bb, then_edge, else_edge)) + if (find_if_case_2 (df, test_bb, then_edge, else_edge)) goto success; } @@ -2938,7 +2936,7 @@ block_jumps_and_fallthru_p (basic_block Return TRUE if we were successful at converting the block. */ static int -find_if_block (bitmap modified, struct ce_if_block * ce_info) +find_if_block (struct ce_if_block * ce_info) { basic_block test_bb = ce_info->test_bb; basic_block then_bb = ce_info->then_bb; @@ -3143,15 +3141,14 @@ find_if_block (bitmap modified, struct c ce_info->else_bb = else_bb; ce_info->join_bb = join_bb; - return process_if_block (modified, ce_info); + return process_if_block (ce_info); } /* Convert a branch over a trap, or a branch to a trap, into a conditional trap. */ static int -find_cond_trap (bitmap modified, - basic_block test_bb, edge then_edge, edge else_edge) +find_cond_trap (basic_block test_bb, edge then_edge, edge else_edge) { basic_block then_bb = then_edge->dest; basic_block else_bb = else_edge->dest; @@ -3216,9 +3213,9 @@ find_cond_trap (bitmap modified, if (EDGE_COUNT (trap_bb->preds) == 0) delete_basic_block (trap_bb); - bitmap_set_bit (modified, test_bb->index); - bitmap_set_bit (modified, then_bb->index); - bitmap_set_bit (modified, else_bb->index); + df_set_bb_dirty (test_bb); + df_set_bb_dirty (then_bb); + df_set_bb_dirty (else_bb); /* If the non-trap block and the test are now adjacent, merge them. Otherwise we must insert a direct branch. */ @@ -3231,7 +3228,7 @@ find_cond_trap (bitmap modified, new_ce_info.then_bb = NULL; new_ce_info.else_bb = NULL; new_ce_info.join_bb = other_bb; - merge_if_block (modified, &new_ce_info); + merge_if_block (&new_ce_info); } else { @@ -3353,8 +3350,7 @@ block_has_only_trap (basic_block bb) /* Tests for case 1 above. */ static int -find_if_case_1 (struct df *df, bitmap modified, - basic_block test_bb, edge then_edge, edge else_edge) +find_if_case_1 (struct df *df, basic_block test_bb, edge then_edge, edge else_edge) { basic_block then_bb = then_edge->dest; basic_block else_bb = else_edge->dest; @@ -3429,8 +3425,8 @@ find_if_case_1 (struct df *df, bitmap mo new_bb = redirect_edge_and_branch_force (FALLTHRU_EDGE (test_bb), else_bb); - bitmap_set_bit (modified, test_bb->index); - bitmap_set_bit (modified, else_bb->index); + df_set_bb_dirty (test_bb); + df_set_bb_dirty (else_bb); then_bb_index = then_bb->index; delete_basic_block (then_bb); @@ -3439,11 +3435,7 @@ find_if_case_1 (struct df *df, bitmap mo block we removed. */ if (new_bb) { - int old_index = new_bb->index; - new_bb->index = then_bb_index; df_bb_replace (then_bb_index, new_bb); - bitmap_set_bit (modified, then_bb_index); - SET_BASIC_BLOCK (old_index, NULL); /* Since the fallthru edge was redirected from test_bb to new_bb, we need to ensure that new_bb is in the same partition as test bb (you can not fall through across section boundaries). */ @@ -3459,8 +3451,7 @@ find_if_case_1 (struct df *df, bitmap mo /* Test for case 2 above. */ static int -find_if_case_2 (struct df *df, bitmap modified, - basic_block test_bb, edge then_edge, edge else_edge) +find_if_case_2 (struct df *df, basic_block test_bb, edge then_edge, edge else_edge) { basic_block then_bb = then_edge->dest; basic_block else_bb = else_edge->dest; @@ -3532,8 +3523,8 @@ find_if_case_2 (struct df *df, bitmap mo /* Conversion went ok, including moving the insns and fixing up the jump. Adjust the CFG to match. */ - bitmap_set_bit (modified, test_bb->index); - bitmap_set_bit (modified, then_bb->index); + df_set_bb_dirty (test_bb); + df_set_bb_dirty (then_bb); delete_basic_block (else_bb); num_true_changes++; @@ -3858,7 +3849,6 @@ if_convert (void) { basic_block bb; int pass; - bitmap modified = BITMAP_ALLOC (NULL); struct df * df; num_possible_if_blocks = 0; @@ -3903,16 +3893,9 @@ if_convert (void) FOR_EACH_BB (bb) { - if (!bitmap_bit_p (modified, bb->index)) - find_if_header (df, modified, bb, pass); - } - - if (cond_exec_changed_p) - { - /* If we are going to go around again, rescan the blocks - that have changed. */ - df_scan_blocks (df, modified); - bitmap_clear (modified); + + if (!df_get_bb_dirty (bb)) + find_if_header (df, bb, pass); } #ifdef IFCVT_MULTIPLE_DUMPS @@ -3955,7 +3938,6 @@ if_convert (void) num_true_changes); } - BITMAP_FREE (modified); #ifdef ENABLE_CHECKING verify_flow_info (); #endif Index: recog.c =================================================================== --- recog.c (revision 118551) +++ recog.c (working copy) @@ -383,9 +383,9 @@ verify_changes (int num) return (i == num_changes); } -/* A group of changes has previously been issued with validate_change and - verified with verify_changes. Update the BB_DIRTY flags of the affected - blocks, and clear num_changes. */ +/* A group of changes has previously been issued with validate_change + and verified with verify_changes. Call df_set_bb_dirty of the + affected blocks, and clear num_changes. */ void confirm_change_group (void) @@ -397,7 +397,7 @@ confirm_change_group (void) if (changes[i].object && INSN_P (changes[i].object) && (bb = BLOCK_FOR_INSN (changes[i].object))) - bb->flags |= BB_DIRTY; + df_set_bb_dirty (bb); num_changes = 0; } Index: emit-rtl.c =================================================================== --- emit-rtl.c (revision 118551) +++ emit-rtl.c (working copy) @@ -3565,7 +3565,7 @@ remove_insn (rtx insn) && (bb = BLOCK_FOR_INSN (insn))) { if (INSN_P (insn)) - bb->flags |= BB_DIRTY; + df_set_bb_dirty (bb); if (BB_HEAD (bb) == insn) { /* Never ever delete the basic block note without deleting whole @@ -3661,14 +3661,14 @@ reorder_insns (rtx from, rtx to, rtx aft && (bb = BLOCK_FOR_INSN (after))) { rtx x; - bb->flags |= BB_DIRTY; + df_set_bb_dirty (bb); if (!BARRIER_P (from) && (bb2 = BLOCK_FOR_INSN (from))) { if (BB_END (bb2) == to) BB_END (bb2) = prev; - bb2->flags |= BB_DIRTY; + df_set_bb_dirty (bb2); } if (BB_END (bb) == after) @@ -3919,7 +3919,7 @@ emit_insn_after_1 (rtx first, rtx after) if (!BARRIER_P (after) && (bb = BLOCK_FOR_INSN (after))) { - bb->flags |= BB_DIRTY; + df_set_bb_dirty (bb); for (last = first; NEXT_INSN (last); last = NEXT_INSN (last)) if (!BARRIER_P (last)) { Index: cfgcleanup.c =================================================================== --- cfgcleanup.c (revision 118540) +++ cfgcleanup.c (working copy) @@ -427,7 +427,7 @@ try_forward_edges (int mode, basic_block int counter; bool threaded = false; int nthreaded_edges = 0; - bool may_thread = first_pass | (b->flags & BB_DIRTY); + bool may_thread = first_pass | df_get_bb_dirty (b); /* Skip complex edges because we don't know how to update them. @@ -461,7 +461,7 @@ try_forward_edges (int mode, basic_block { basic_block new_target = NULL; bool new_target_threaded = false; - may_thread |= target->flags & BB_DIRTY; + may_thread |= df_get_bb_dirty (target); if (FORWARDER_BLOCK_P (target) && !(single_succ_edge (target)->flags & EDGE_CROSSING) @@ -651,7 +651,7 @@ merge_blocks_move_predecessor_nojumps (b /* Scramble the insn chain. */ if (BB_END (a) != PREV_INSN (BB_HEAD (b))) reorder_insns_nobb (BB_HEAD (a), BB_END (a), PREV_INSN (BB_HEAD (b))); - a->flags |= BB_DIRTY; + df_set_bb_dirty (a); if (dump_file) fprintf (dump_file, "Moved block %d before %d and merged.\n", @@ -1731,7 +1731,7 @@ try_crossjump_to_edge (int mode, edge e1 redirect_to->count += src1->count; redirect_to->frequency += src1->frequency; /* We may have some registers visible through the block. */ - redirect_to->flags |= BB_DIRTY; + df_set_bb_dirty (redirect_to); /* Recompute the frequencies and counts of outgoing edges. */ FOR_EACH_EDGE (s, ei, redirect_to->succs) @@ -1880,8 +1880,8 @@ try_crossjump_bb (int mode, basic_block /* If nothing changed since the last attempt, there is nothing we can do. */ if (!first_pass - && (!(e->src->flags & BB_DIRTY) - && !(fallthru->src->flags & BB_DIRTY))) + && (!(df_get_bb_dirty (e->src)) + && !(df_get_bb_dirty (fallthru->src)))) continue; if (try_crossjump_to_edge (mode, e, fallthru)) @@ -1930,8 +1930,8 @@ try_crossjump_bb (int mode, basic_block /* If nothing changed since the last attempt, there is nothing we can do. */ if (!first_pass - && (!(e->src->flags & BB_DIRTY) - && !(e2->src->flags & BB_DIRTY))) + && (!(df_get_bb_dirty (e->src)) + && !(df_get_bb_dirty (e2->src)))) continue; if (try_crossjump_to_edge (mode, e, e2)) Index: basic-block.h =================================================================== --- basic-block.h (revision 118540) +++ basic-block.h (working copy) @@ -292,10 +292,6 @@ DEF_VEC_ALLOC_P(basic_block,heap); enum bb_flags { - - /* Set if insns in BB have are modified. Used for updating liveness info. */ - BB_DIRTY = 1, - /* Only set on blocks that have just been created by create_bb. */ BB_NEW = 2, Index: cfgrtl.c =================================================================== --- cfgrtl.c (revision 118551) +++ cfgrtl.c (working copy) @@ -540,6 +540,8 @@ rtl_split_block (basic_block bb, void *i FOR_EACH_EDGE (e, ei, new_bb->succs) e->src = new_bb; + /* The new block starts off being dirty. */ + df_set_bb_dirty (bb); return new_bb; } @@ -989,7 +991,7 @@ rtl_redirect_edge_and_branch (edge e, ba if ((ret = try_redirect_by_replacing_jump (e, target, false)) != NULL) { - src->flags |= BB_DIRTY; + df_set_bb_dirty (src); return ret; } @@ -997,7 +999,7 @@ rtl_redirect_edge_and_branch (edge e, ba if (!ret) return NULL; - src->flags |= BB_DIRTY; + df_set_bb_dirty (src); return ret; } @@ -1182,7 +1184,7 @@ rtl_redirect_edge_and_branch_force (edge /* In case the edge redirection failed, try to force it to be non-fallthru and redirect newly created simplejump. */ - e->src->flags |= BB_DIRTY; + df_set_bb_dirty (e->src); return force_nonfallthru_and_redirect (e, target); } @@ -2164,7 +2166,7 @@ purge_dead_edges (basic_block bb) } remove_edge (e); - bb->flags |= BB_DIRTY; + df_set_bb_dirty (bb); purged = true; } @@ -2232,7 +2234,7 @@ purge_dead_edges (basic_block bb) } /* We do not need this edge. */ - bb->flags |= BB_DIRTY; + df_set_bb_dirty (bb); purged = true; remove_edge (e); } @@ -2304,7 +2306,7 @@ purge_dead_edges (basic_block bb) { if (!(e->flags & (EDGE_FALLTHRU | EDGE_FAKE))) { - bb->flags |= BB_DIRTY; + df_set_bb_dirty (bb); remove_edge (e); purged = true; } @@ -2372,7 +2374,7 @@ cfg_layout_redirect_edge_and_branch (edg if (e->src != ENTRY_BLOCK_PTR && (ret = try_redirect_by_replacing_jump (e, dest, true))) { - src->flags |= BB_DIRTY; + df_set_bb_dirty (src); return ret; } @@ -2383,7 +2385,7 @@ cfg_layout_redirect_edge_and_branch (edg fprintf (dump_file, "Redirecting entry edge from bb %i to %i\n", e->src->index, dest->index); - e->src->flags |= BB_DIRTY; + df_set_bb_dirty (e->src); redirect_edge_succ (e, dest); return e; } @@ -2409,7 +2411,7 @@ cfg_layout_redirect_edge_and_branch (edg redirected = redirect_branch_edge (e, dest); gcc_assert (redirected); e->flags |= EDGE_FALLTHRU; - e->src->flags |= BB_DIRTY; + df_set_bb_dirty (e->src); return e; } /* In case we are redirecting fallthru edge to the branch edge @@ -2435,7 +2437,7 @@ cfg_layout_redirect_edge_and_branch (edg /* We don't want simplejumps in the insn stream during cfglayout. */ gcc_assert (!simplejump_p (BB_END (src))); - src->flags |= BB_DIRTY; + df_set_bb_dirty (src); return ret; } Index: modulo-sched.c =================================================================== --- modulo-sched.c (revision 118540) +++ modulo-sched.c (working copy) @@ -1234,7 +1234,7 @@ sms_schedule (void) if (! flag_resched_modulo_sched) g->bb->flags |= BB_DISABLE_SCHEDULE; /* The life-info is not valid any more. */ - g->bb->flags |= BB_DIRTY; + df_set_bb_dirty (g->bb); reg_move_replaces = generate_reg_moves (ps); if (dump_file)