+2017-06-02 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/80948
+ * tree-tailcall.c (find_tail_calls): Track stmts to move in
+ stmt order as well.
+
2017-06-02 Richard Biener <rguenther@suse.de>
* tree-vect-loop.c (vect_analyze_loop_operations): Not relevant
since we are running after dce. */
m = NULL_TREE;
a = NULL_TREE;
- auto_bitmap to_move;
+ auto_bitmap to_move_defs;
+ auto_vec<gimple *> to_move_stmts;
abb = bb;
agsi = gsi;
/* This is a gimple assign. */
par ret = process_assignment (as_a <gassign *> (stmt), gsi,
- &tmp_m, &tmp_a, &ass_var, to_move);
+ &tmp_m, &tmp_a, &ass_var, to_move_defs);
if (ret == FAIL)
return;
else if (ret == TRY_MOVE)
for (unsigned opno = 1; opno < gimple_num_ops (stmt); ++opno)
{
tree op = gimple_op (stmt, opno);
- if (independent_of_stmt_p (op, stmt, gsi, to_move) != op)
+ if (independent_of_stmt_p (op, stmt, gsi, to_move_defs) != op)
return;
}
- bitmap_set_bit (to_move, SSA_NAME_VERSION (gimple_assign_lhs (stmt)));
+ bitmap_set_bit (to_move_defs,
+ SSA_NAME_VERSION (gimple_assign_lhs (stmt)));
+ to_move_stmts.safe_push (stmt);
continue;
}
/* Move queued defs. */
if (tail_recursion)
{
- bitmap_iterator bi;
unsigned i;
- EXECUTE_IF_SET_IN_BITMAP (to_move, 0, i, bi)
+ FOR_EACH_VEC_ELT (to_move_stmts, i, stmt)
{
- stmt = SSA_NAME_DEF_STMT (ssa_name (i));
gimple_stmt_iterator mgsi = gsi_for_stmt (stmt);
gsi_move_before (&mgsi, &gsi);
}