@@ -1,5 +1,16 @@
2014-11-03 David Malcolm <dmalcolm@redhat.com>
+ * gimple-fold.h (rewrite_to_defined_overflow): Strengthen from
+ gimple to gassign *.
+ * gimple-fold.c (rewrite_to_defined_overflow): Likewise.
+ * tree-scalar-evolution.c (scev_const_prop): Replace
+ is_gimple_assign with a dyn_cast, introducing local "assign_stmt"
+ and using it in place of "stmt" for typesafety.
+ * tree-ssa-loop-im.c
+ (move_computations_dom_walker::before_dom_children): Likewise.
+
+2014-11-03 David Malcolm <dmalcolm@redhat.com>
+
* gimple-fold.c (fold_gimple_assign): Strengthen local "stmt" from
gimple to gassign * via a checked cast.
(gsi_replace_with_seq_vops): Add a checked cast within region
@@ -5503,7 +5503,7 @@ arith_code_with_undefined_signed_overflow (tree_code code)
a modified form of STMT itself. */
gimple_seq
-rewrite_to_defined_overflow (gimple stmt)
+rewrite_to_defined_overflow (gassign *stmt)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -45,7 +45,7 @@ extern tree gimple_get_virt_method_for_vtable (HOST_WIDE_INT, tree,
extern bool gimple_val_nonnegative_real_p (tree);
extern tree gimple_fold_indirect_ref (tree);
extern bool arith_code_with_undefined_signed_overflow (tree_code);
-extern gimple_seq rewrite_to_defined_overflow (gimple);
+extern gimple_seq rewrite_to_defined_overflow (gassign *);
/* gimple_build, functionally matching fold_buildN, outputs stmts
int the provided sequence, matching and simplifying them on-the-fly.
@@ -3518,13 +3518,14 @@ scev_const_prop (void)
{
gimple stmt = gsi_stmt (gsi2);
gimple_stmt_iterator gsi3 = gsi2;
+ gassign *assign_stmt;
gsi_next (&gsi2);
gsi_remove (&gsi3, false);
- if (is_gimple_assign (stmt)
+ if ((assign_stmt = dyn_cast <gassign *> (stmt))
&& arith_code_with_undefined_signed_overflow
- (gimple_assign_rhs_code (stmt)))
+ (gimple_assign_rhs_code (assign_stmt)))
gsi_insert_seq_before (&gsi,
- rewrite_to_defined_overflow (stmt),
+ rewrite_to_defined_overflow (assign_stmt),
GSI_SAME_STMT);
else
gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
@@ -1244,6 +1244,7 @@ move_computations_dom_walker::before_dom_children (basic_block bb)
edge e;
gimple stmt = gsi_stmt (bsi);
+ gassign *assign_stmt;
lim_data = get_lim_data (stmt);
if (lim_data == NULL)
@@ -1298,15 +1299,16 @@ move_computations_dom_walker::before_dom_children (basic_block bb)
when the target loop header is executed and the stmt may
invoke undefined integer or pointer overflow rewrite it to
unsigned arithmetic. */
- if (is_gimple_assign (stmt)
- && INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_lhs (stmt)))
- && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (gimple_assign_lhs (stmt)))
+ if ((assign_stmt = dyn_cast <gassign *> (stmt))
+ && INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_lhs (assign_stmt)))
+ && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (
+ gimple_assign_lhs (assign_stmt)))
&& arith_code_with_undefined_signed_overflow
- (gimple_assign_rhs_code (stmt))
+ (gimple_assign_rhs_code (assign_stmt))
&& (!ALWAYS_EXECUTED_IN (bb)
|| !(ALWAYS_EXECUTED_IN (bb) == level
|| flow_loop_nested_p (ALWAYS_EXECUTED_IN (bb), level))))
- gsi_insert_seq_on_edge (e, rewrite_to_defined_overflow (stmt));
+ gsi_insert_seq_on_edge (e, rewrite_to_defined_overflow (assign_stmt));
else
gsi_insert_on_edge (e, stmt);
}