+2012-08-07 Richard Guenther <rguenther@suse.de>
+
+ * tree-into-ssa.c (rewrite_stmt): Remove clobbers for variables
+ we rewrite into SSA form.
+ (rewrite_enter_block): Adjust.
+ * gimple-iterator.c (gsi_replace): Also allow replacement with
+ a stmt without a lhs.
+ * tree-ssa-live.c (remove_unused_locals): Remove code handling
+ clobbers of SSA names.
+ * tree-nested.c (convert_local_reference_stmt): Remove clobbers
+ for variables we access through the local chain.
+ * tree-cfg.c (verify_gimple_assign_single): Verify clobbers
+ clobber full decls only.
+
2012-08-07 Richard Guenther <rguenther@suse.de>
* gimple.h (gimple_phi_set_result): Adjust SSA_NAME_DEF_STMT.
definition of a variable when a new real or virtual definition is found. */
static void
-rewrite_stmt (gimple_stmt_iterator si)
+rewrite_stmt (gimple_stmt_iterator *si)
{
use_operand_p use_p;
def_operand_p def_p;
ssa_op_iter iter;
- gimple stmt = gsi_stmt (si);
+ gimple stmt = gsi_stmt (*si);
/* If mark_def_sites decided that we don't need to rewrite this
statement, ignore it. */
FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, iter, SSA_OP_ALL_DEFS)
{
tree var = DEF_FROM_PTR (def_p);
- tree name = make_ssa_name (var, stmt);
+ tree name;
tree tracked_var;
+
gcc_assert (DECL_P (var));
+
+ if (gimple_clobber_p (stmt)
+ && is_gimple_reg (var))
+ {
+ /* If we rewrite a DECL into SSA form then drop its
+ clobber stmts and replace uses with a new default def. */
+ gcc_assert (TREE_CODE (var) == VAR_DECL
+ && !gimple_vdef (stmt));
+ gsi_replace (si, gimple_build_nop (), true);
+ register_new_def (get_or_create_ssa_default_def (cfun, var), var);
+ break;
+ }
+
+ name = make_ssa_name (var, stmt);
SET_DEF (def_p, name);
register_new_def (DEF_FROM_PTR (def_p), var);
if (tracked_var)
{
gimple note = gimple_build_debug_bind (tracked_var, name, stmt);
- gsi_insert_after (&si, note, GSI_SAME_STMT);
+ gsi_insert_after (si, note, GSI_SAME_STMT);
}
}
}
of a variable when a new real or virtual definition is found. */
if (TEST_BIT (interesting_blocks, bb->index))
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- rewrite_stmt (gsi);
+ rewrite_stmt (&gsi);
/* Step 3. Visit all the successor blocks of BB looking for PHI nodes.
For every PHI node found, add a new argument containing the current
*handled_ops_p = false;
return NULL_TREE;
+ case GIMPLE_ASSIGN:
+ if (gimple_clobber_p (stmt))
+ {
+ tree lhs = gimple_assign_lhs (stmt);
+ if (!use_pointer_in_frame (lhs)
+ && lookup_field_for_decl (info, lhs, NO_INSERT))
+ {
+ gsi_replace (gsi, gimple_build_nop (), true);
+ break;
+ }
+ }
+ *handled_ops_p = false;
+ return NULL_TREE;
+
default:
/* For every other statement that we are not interested in
handling here, let the walker traverse the operands. */