From: Richard Biener Date: Fri, 2 Jun 2017 12:34:32 +0000 (+0000) Subject: re PR tree-optimization/80948 (test case gcc.dg/torture/pr68017.c fails with ICE... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bd53b2574d0326d23e0dde6eb5e31bf4e952ccf1;p=gcc.git re PR tree-optimization/80948 (test case gcc.dg/torture/pr68017.c fails with ICE starting with r248771) 2017-06-02 Richard Biener PR tree-optimization/80948 * tree-tailcall.c (find_tail_calls): Track stmts to move in stmt order as well. From-SVN: r248824 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 122c8cdcf72..499e6bb6385 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-06-02 Richard Biener + + PR tree-optimization/80948 + * tree-tailcall.c (find_tail_calls): Track stmts to move in + stmt order as well. + 2017-06-02 Richard Biener * tree-vect-loop.c (vect_analyze_loop_operations): Not relevant diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index f6cfce52287..bc370af610f 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -531,7 +531,8 @@ find_tail_calls (basic_block bb, struct tailcall **ret) since we are running after dce. */ m = NULL_TREE; a = NULL_TREE; - auto_bitmap to_move; + auto_bitmap to_move_defs; + auto_vec to_move_stmts; abb = bb; agsi = gsi; @@ -563,7 +564,7 @@ find_tail_calls (basic_block bb, struct tailcall **ret) /* This is a gimple assign. */ par ret = process_assignment (as_a (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) @@ -573,10 +574,12 @@ find_tail_calls (basic_block bb, struct tailcall **ret) 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; } @@ -622,11 +625,9 @@ find_tail_calls (basic_block bb, struct tailcall **ret) /* 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); }