VN_INFO (forcedname)->value_id = get_next_value_id ();
nameexpr = get_or_alloc_expr_for_name (forcedname);
add_to_value (VN_INFO (forcedname)->value_id, nameexpr);
- bitmap_value_replace_in_set (NEW_SETS (block), nameexpr);
+ if (NEW_SETS (block))
+ bitmap_value_replace_in_set (NEW_SETS (block), nameexpr);
bitmap_value_replace_in_set (AVAIL_OUT (block), nameexpr);
}
bitmap_insert_into_set (PHI_GEN (block), newphi);
bitmap_value_replace_in_set (AVAIL_OUT (block),
newphi);
- bitmap_insert_into_set (NEW_SETS (block),
- newphi);
+ if (NEW_SETS (block))
+ bitmap_insert_into_set (NEW_SETS (block), newphi);
/* If we insert a PHI node for a conversion of another PHI node
in the same basic-block try to preserve range information.
fprintf (dump_file, "Starting insert iteration %d\n", num_iterations);
changed = false;
- /* Insert expressions for hoisting. Do a backward walk here since
- inserting into BLOCK exposes new opportunities in its predecessors. */
- if (flag_code_hoisting)
- for (int idx = rpo_num - 1; idx >= 0; --idx)
- {
- basic_block block = BASIC_BLOCK_FOR_FN (cfun, rpo[idx]);
- if (EDGE_COUNT (block->succs) >= 2)
- changed |= do_hoist_insertion (block);
- }
for (int idx = 0; idx < rpo_num; ++idx)
{
basic_block block = BASIC_BLOCK_FOR_FN (cfun, rpo[idx]);
statistics_histogram_event (cfun, "insert iterations", num_iterations);
+ /* AVAIL_OUT is not needed after insertion so we don't have to
+ propagate NEW_SETS from hoist insertion. */
+ FOR_ALL_BB_FN (bb, cfun)
+ {
+ bitmap_set_pool.remove (NEW_SETS (bb));
+ NEW_SETS (bb) = NULL;
+ }
+
+ /* Insert expressions for hoisting. Do a backward walk here since
+ inserting into BLOCK exposes new opportunities in its predecessors.
+ Since PRE and hoist insertions can cause back-to-back iteration
+ and we are interested in PRE insertion exposed hoisting opportunities
+ but not in hoisting exposed PRE ones do hoist insertion only after
+ PRE insertion iteration finished and do not iterate it. */
+ if (flag_code_hoisting)
+ for (int idx = rpo_num - 1; idx >= 0; --idx)
+ {
+ basic_block block = BASIC_BLOCK_FOR_FN (cfun, rpo[idx]);
+ if (EDGE_COUNT (block->succs) >= 2)
+ changed |= do_hoist_insertion (block);
+ }
+
free (rpo);
}