Mercurial > hg > CbC > CbC_gcc
diff gcc/tree-ssa-phiopt.c @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | a06113de4d67 |
children | b7f97abdc517 |
line wrap: on
line diff
--- a/gcc/tree-ssa-phiopt.c Sun Feb 07 18:28:00 2010 +0900 +++ b/gcc/tree-ssa-phiopt.c Fri Feb 12 23:39:51 2010 +0900 @@ -207,7 +207,7 @@ 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; @@ -307,7 +307,7 @@ } free (bb_order); - + if (do_store_elim) pointer_set_destroy (nontrap); /* If the CFG has changed, we should cleanup the CFG. */ @@ -332,12 +332,12 @@ { 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); @@ -384,7 +384,12 @@ 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. @@ -513,6 +518,8 @@ 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, @@ -521,6 +528,13 @@ 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); @@ -682,7 +696,7 @@ && operand_equal_for_phi_arg_p (arg_false, larger)) { /* Case - + if (smaller < larger) rslt = smaller; else @@ -843,7 +857,7 @@ /* 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); } @@ -891,7 +905,7 @@ 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. */ @@ -904,7 +918,7 @@ 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)) @@ -1139,18 +1153,12 @@ /* 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); @@ -1183,6 +1191,7 @@ 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. */ @@ -1190,6 +1199,7 @@ || 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)) @@ -1230,6 +1240,7 @@ 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); @@ -1237,8 +1248,8 @@ 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)); @@ -1276,7 +1287,7 @@ NULL, /* next */ 0, /* static_pass_number */ TV_TREE_PHIOPT, /* tv_id */ - PROP_cfg | PROP_ssa | PROP_alias, /* properties_required */ + PROP_cfg | PROP_ssa, /* properties_required */ 0, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */ @@ -1305,7 +1316,7 @@ NULL, /* next */ 0, /* static_pass_number */ TV_TREE_PHIOPT, /* tv_id */ - PROP_cfg | PROP_ssa | PROP_alias, /* properties_required */ + PROP_cfg | PROP_ssa, /* properties_required */ 0, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */