summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2014-11-06 21:20:28 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2014-11-06 21:20:28 -0500
commitb6bf8f4dfcf4752cddc8bfc7c3e1f6ac6d4b455a (patch)
tree57eed250fdc4ccafb4758f07b4225e4bc42a5b46
parent9176fe07b9242a2343b678351f52edf3c0157fa2 (diff)
downloadgcc-b6bf8f4dfcf4752cddc8bfc7c3e1f6ac6d4b455a.tar.gz
tree-ssa-ter.c: Use gassign
gcc/ChangeLog.gimple-classes: * tree-ssa-ter.c (find_replaceable_in_bb): Replace is_gimple_assign with a dyn_cast, introducing local "def_assign" and using it in place of "def_stmt" for typesafety. Add a checked cast.
-rw-r--r--gcc/ChangeLog.gimple-classes7
-rw-r--r--gcc/tree-ssa-ter.c16
2 files changed, 17 insertions, 6 deletions
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 0bd0421ad12..43c05ec8dc4 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,12 @@
2014-11-06 David Malcolm <dmalcolm@redhat.com>
+ * tree-ssa-ter.c (find_replaceable_in_bb): Replace
+ is_gimple_assign with a dyn_cast, introducing local "def_assign"
+ and using it in place of "def_stmt" for typesafety. Add a checked
+ cast.
+
+2014-11-06 David Malcolm <dmalcolm@redhat.com>
+
* tree-ssa-tail-merge.c (same_succ_hash): Add checked cast.
(gimple_equal_p): Add checked casts.
diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c
index 96b3959e9a8..adbc5f9eed5 100644
--- a/gcc/tree-ssa-ter.c
+++ b/gcc/tree-ssa-ter.c
@@ -640,14 +640,18 @@ find_replaceable_in_bb (temp_expr_table_p tab, basic_block bb)
if (gimple_vdef (stmt))
{
gimple def_stmt = SSA_NAME_DEF_STMT (use);
- while (is_gimple_assign (def_stmt)
- && gimple_assign_rhs_code (def_stmt) == SSA_NAME)
- def_stmt
- = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (def_stmt));
+ while (gassign *def_assign = dyn_cast <gassign *> (def_stmt))
+ {
+ if (gimple_assign_rhs_code (def_assign) != SSA_NAME)
+ break;
+ def_stmt
+ = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (def_assign));
+ }
if (gimple_vuse (def_stmt)
&& gimple_assign_single_p (def_stmt)
- && stmt_may_clobber_ref_p (stmt,
- gimple_assign_rhs1 (def_stmt)))
+ && stmt_may_clobber_ref_p (
+ stmt,
+ gimple_assign_rhs1 (as_a <gassign *> (def_stmt))))
{
/* For calls, it is not a problem if USE is among
call's arguments or say OBJ_TYPE_REF argument,