summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2014-11-03 14:40:31 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2014-11-03 14:40:31 -0500
commit8285b4c9a87877973963ae3c450a7ffb4659c97d (patch)
treecd12484ff5a1a0a5871e690fc689c37251e7eed6
parent75383e848cd45226552f383a8765eadf230049dd (diff)
downloadgcc-8285b4c9a87877973963ae3c450a7ffb4659c97d.tar.gz
tree-ssa-dse.c: Use gassign
gcc/ChangeLog.gimple-classes: * tree-ssa-dse.c (dse_optimize_stmt): Add checked cast. Replace is_gimple_assign with dyn_cast, introducing local gassign * "assign_stmt", using it in place of "stmt" for typesafety.
-rw-r--r--gcc/ChangeLog.gimple-classes6
-rw-r--r--gcc/tree-ssa-dse.c11
2 files changed, 12 insertions, 5 deletions
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 48942c1c342..9b455c30c59 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,11 @@
2014-11-03 David Malcolm <dmalcolm@redhat.com>
+ * tree-ssa-dse.c (dse_optimize_stmt): Add checked cast. Replace
+ is_gimple_assign with dyn_cast, introducing local gassign *
+ "assign_stmt", using it in place of "stmt" for typesafety.
+
+2014-11-03 David Malcolm <dmalcolm@redhat.com>
+
* tree-ssa-dom.c (initialize_hash_element): Replace check for
GIMPLE_ASSIGN with a dyn_cast, introducing local "assign_stmt",
using it in place of "stmt" for typesafety.
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index 3434a8009e8..efffa162441 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -233,7 +233,8 @@ dse_optimize_stmt (gimple_stmt_iterator *gsi)
/* Don't return early on *this_2(D) ={v} {CLOBBER}. */
if (gimple_has_volatile_ops (stmt)
&& (!gimple_clobber_p (stmt)
- || TREE_CODE (gimple_assign_lhs (stmt)) != MEM_REF))
+ || (TREE_CODE (gimple_assign_lhs (as_a <gassign *> (stmt)))
+ != MEM_REF)))
return;
/* We know we have virtual definitions. We can handle assignments and
@@ -287,18 +288,18 @@ dse_optimize_stmt (gimple_stmt_iterator *gsi)
}
}
- if (is_gimple_assign (stmt))
+ if (gassign *assign_stmt = dyn_cast <gassign *> (stmt))
{
gimple use_stmt;
/* Self-assignments are zombies. */
- if (operand_equal_p (gimple_assign_rhs1 (stmt),
- gimple_assign_lhs (stmt), 0))
+ if (operand_equal_p (gimple_assign_rhs1 (assign_stmt),
+ gimple_assign_lhs (assign_stmt), 0))
use_stmt = stmt;
else
{
ao_ref ref;
- ao_ref_init (&ref, gimple_assign_lhs (stmt));
+ ao_ref_init (&ref, gimple_assign_lhs (assign_stmt));
if (!dse_possible_dead_store_p (&ref, stmt, &use_stmt))
return;
}