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.
From-SVN: r190200
2012-08-07 Richard Guenther <rguenther@suse.de>
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.
* tree-phinodes.c (make_phi_node): Allow a NULL var.
* tree-into-ssa.c (insert_phi_nodes_for): Simplify.
* gimple.h (gimple_phi_set_result): Adjust SSA_NAME_DEF_STMT.
* tree-phinodes.c (make_phi_node): Allow a NULL var.
* tree-into-ssa.c (insert_phi_nodes_for): Simplify.
if (stmt == orig_stmt)
return;
if (stmt == orig_stmt)
return;
- gcc_assert (!gimple_has_lhs (orig_stmt)
+ gcc_assert (!gimple_has_lhs (orig_stmt) || !gimple_has_lhs (stmt)
|| gimple_get_lhs (orig_stmt) == gimple_get_lhs (stmt));
gimple_set_location (stmt, gimple_location (orig_stmt));
|| gimple_get_lhs (orig_stmt) == gimple_get_lhs (stmt));
gimple_set_location (stmt, gimple_location (orig_stmt));
+ if (gimple_clobber_p (stmt)
+ && !DECL_P (lhs))
+ {
+ error ("non-decl LHS in clobber statement");
+ debug_generic_expr (lhs);
+ return true;
+ }
+
if (handled_component_p (lhs))
res |= verify_types_in_gimple_reference (lhs, true);
if (handled_component_p (lhs))
res |= verify_types_in_gimple_reference (lhs, true);
definition of a variable when a new real or virtual definition is found. */
static void
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;
{
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. */
/* 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);
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);
gcc_assert (DECL_P (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);
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);
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))
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))
/* 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
/* 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;
*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. */
default:
/* For every other statement that we are not interested in
handling here, let the walker traverse the operands. */
if (gimple_clobber_p (stmt))
{
tree lhs = gimple_assign_lhs (stmt);
if (gimple_clobber_p (stmt))
{
tree lhs = gimple_assign_lhs (stmt);
- lhs = get_base_address (lhs);
- if (TREE_CODE (lhs) == SSA_NAME)
- lhs = SSA_NAME_VAR (lhs);
if (TREE_CODE (lhs) == VAR_DECL && !is_used_p (lhs))
{
unlink_stmt_vdef (stmt);
if (TREE_CODE (lhs) == VAR_DECL && !is_used_p (lhs))
{
unlink_stmt_vdef (stmt);