@@ -1,3 +1,13 @@
+2014-11-03 David Malcolm <dmalcolm@redhat.com>
+
+ * auto-profile.c (afdo_propagate_circuit): Replace a check for
+ GIMPLE_ASSIGN within the while loop with a dyn_cast, introducing
+ a local "def_assign", using it in place of "stmt" for typesafety.
+ This involves replacing the series of while conditions in the head
+ of the while into a list of conditionals within its body that
+ break out of the loop, thus requiring the conditions to be
+ negated.
+
2014-10-31 David Malcolm <dmalcolm@redhat.com>
* tree-ssa-forwprop.c (get_prop_source_stmt): Strengthen return
@@ -1262,10 +1262,17 @@ afdo_propagate_circuit (const bb_set &annotated_bb, edge_set *annotated_edge)
if (!is_bb_annotated (bb, annotated_bb))
continue;
def_stmt = SSA_NAME_DEF_STMT (cmp_lhs);
- while (def_stmt && gimple_code (def_stmt) == GIMPLE_ASSIGN
- && gimple_assign_single_p (def_stmt)
- && TREE_CODE (gimple_assign_rhs1 (def_stmt)) == SSA_NAME)
- def_stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (def_stmt));
+ while (def_stmt)
+ {
+ gassign *def_assign = dyn_cast <gassign *> (def_stmt);
+ if (!def_assign)
+ break;
+ if (!gimple_assign_single_p (def_assign))
+ break;
+ if (TREE_CODE (gimple_assign_rhs1 (def_assign)) != SSA_NAME)
+ break;
+ def_stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (def_assign));
+ }
if (!def_stmt)
continue;
gphi *phi_stmt = dyn_cast <gphi *> (def_stmt);