bb_order = blocks_in_phiopt_order ();
n = n_basic_blocks - NUM_FIXED_BLOCKS;
- for (i = 0; i < n; i++)
+ for (i = 0; i < n; i++)
{
gimple cond_stmt, phi;
basic_block bb1, bb2;
}
free (bb_order);
-
+
if (do_store_elim)
pointer_set_destroy (nontrap);
/* If the CFG has changed, we should cleanup the CFG. */
{
basic_block x, y;
basic_block *order = XNEWVEC (basic_block, n_basic_blocks);
- unsigned n = n_basic_blocks - NUM_FIXED_BLOCKS;
+ unsigned n = n_basic_blocks - NUM_FIXED_BLOCKS;
unsigned np, i;
- sbitmap visited = sbitmap_alloc (last_basic_block);
+ sbitmap visited = sbitmap_alloc (last_basic_block);
-#define MARK_VISITED(BB) (SET_BIT (visited, (BB)->index))
-#define VISITED_P(BB) (TEST_BIT (visited, (BB)->index))
+#define MARK_VISITED(BB) (SET_BIT (visited, (BB)->index))
+#define VISITED_P(BB) (TEST_BIT (visited, (BB)->index))
sbitmap_zero (visited);
empty_block_p (basic_block bb)
{
/* BB must have no executable statements. */
- return gsi_end_p (gsi_after_labels (bb));
+ gimple_stmt_iterator gsi = gsi_after_labels (bb);
+ if (gsi_end_p (gsi))
+ return true;
+ if (is_gimple_debug (gsi_stmt (gsi)))
+ gsi_next_nondebug (&gsi);
+ return gsi_end_p (gsi);
}
/* Replace PHI node element whose edge is E in block BB with variable NEW.
if (!useless_type_conversion_p (TREE_TYPE (result), TREE_TYPE (new_var)))
{
+ source_location locus_0, locus_1;
+
new_var2 = create_tmp_var (TREE_TYPE (result), NULL);
add_referenced_var (new_var2);
new_stmt = gimple_build_assign_with_ops (CONVERT_EXPR, new_var2,
gimple_assign_set_lhs (new_stmt, new_var2);
gsi_insert_before (&gsi, new_stmt, GSI_SAME_STMT);
new_var = new_var2;
+
+ /* Set the locus to the first argument, unless is doesn't have one. */
+ locus_0 = gimple_phi_arg_location (phi, 0);
+ locus_1 = gimple_phi_arg_location (phi, 1);
+ if (locus_0 == UNKNOWN_LOCATION)
+ locus_0 = locus_1;
+ gimple_set_location (new_stmt, locus_0);
}
replace_phi_edge_with_variable (cond_bb, e1, phi, new_var);
&& operand_equal_for_phi_arg_p (arg_false, larger))
{
/* Case
-
+
if (smaller < larger)
rslt = smaller;
else
/* Move the statement from the middle block. */
gsi = gsi_last_bb (cond_bb);
- gsi_from = gsi_last_bb (middle_bb);
+ gsi_from = gsi_last_nondebug_bb (middle_bb);
gsi_move_before (&gsi_from, &gsi);
}
optimize. */
if (assign == NULL)
return false;
-
+
/* If we got here, then we have found the only executable statement
in OTHER_BLOCK. If it is anything other than arg = -arg1 or
arg1 = -arg0, then we can not optimize. */
return false;
rhs = gimple_assign_rhs1 (assign);
-
+
/* The assignment has to be arg0 = -arg1 or arg1 = -arg0. */
if (!(lhs == arg0 && rhs == arg1)
&& !(lhs == arg1 && rhs == arg0))
/* Setup callbacks for the generic dominator tree walker. */
nontrap_set = nontrap;
- walk_data.walk_stmts_backward = false;
walk_data.dom_direction = CDI_DOMINATORS;
walk_data.initialize_block_local_data = NULL;
- walk_data.before_dom_children_before_stmts = nt_init_block;
- walk_data.before_dom_children_walk_stmts = NULL;
- walk_data.before_dom_children_after_stmts = NULL;
- walk_data.after_dom_children_before_stmts = NULL;
- walk_data.after_dom_children_walk_stmts = NULL;
- walk_data.after_dom_children_after_stmts = nt_fini_block;
+ walk_data.before_dom_children = nt_init_block;
+ walk_data.after_dom_children = nt_fini_block;
walk_data.global_data = NULL;
walk_data.block_local_data_size = 0;
- walk_data.interesting_blocks = NULL;
init_walk_dominator_tree (&walk_data);
walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
tree lhs, rhs, name;
gimple newphi, new_stmt;
gimple_stmt_iterator gsi;
+ source_location locus;
enum tree_code code;
/* Check if middle_bb contains of only one store. */
|| gimple_code (assign) != GIMPLE_ASSIGN)
return false;
+ locus = gimple_location (assign);
lhs = gimple_assign_lhs (assign);
rhs = gimple_assign_rhs1 (assign);
if (!INDIRECT_REF_P (lhs))
new_stmt = gimple_build_assign (condstoretemp, lhs);
name = make_ssa_name (condstoretemp, new_stmt);
gimple_assign_set_lhs (new_stmt, name);
+ gimple_set_location (new_stmt, locus);
mark_symbols_for_renaming (new_stmt);
gsi_insert_on_edge (e1, new_stmt);
holding the old RHS, and the other holding the temporary
where we stored the old memory contents. */
newphi = create_phi_node (condstoretemp, join_bb);
- add_phi_arg (newphi, rhs, e0);
- add_phi_arg (newphi, name, e1);
+ add_phi_arg (newphi, rhs, e0, locus);
+ add_phi_arg (newphi, name, e1, locus);
lhs = unshare_expr (lhs);
new_stmt = gimple_build_assign (lhs, PHI_RESULT (newphi));