diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-06 06:58:21 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-06 06:58:21 +0000 |
commit | 929a4812b1cb0741d8749af94053b41e74f7a748 (patch) | |
tree | b504669632d701e02d71a41d733c9cc3d03e7af4 /gcc/tree-vect-patterns.c | |
parent | 80c0ee75cf4499310abced335499c952417f10e1 (diff) | |
download | gcc-929a4812b1cb0741d8749af94053b41e74f7a748.tar.gz |
* tree-vect-patterns.c (vect_pattern_recog_1): Add stmts_to_replace
argument, truncate it at the beginning instead of allocating there
and freeing at the end.
(vect_pattern_recog): Allocate stmts_to_replace here and free at end,
pass its address to vect_pattern_recog_1.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179592 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-patterns.c')
-rw-r--r-- | gcc/tree-vect-patterns.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index 7fc107cafa9..5ed60b79552 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -1281,7 +1281,8 @@ vect_mark_pattern_stmts (gimple orig_stmt, gimple pattern_stmt, static void vect_pattern_recog_1 ( gimple (* vect_recog_func) (VEC (gimple, heap) **, tree *, tree *), - gimple_stmt_iterator si) + gimple_stmt_iterator si, + VEC (gimple, heap) **stmts_to_replace) { gimple stmt = gsi_stmt (si), pattern_stmt; stmt_vec_info stmt_info; @@ -1291,14 +1292,14 @@ vect_pattern_recog_1 ( enum tree_code code; int i; gimple next; - VEC (gimple, heap) *stmts_to_replace = VEC_alloc (gimple, heap, 1); - VEC_quick_push (gimple, stmts_to_replace, stmt); - pattern_stmt = (* vect_recog_func) (&stmts_to_replace, &type_in, &type_out); + VEC_truncate (gimple, *stmts_to_replace, 0); + VEC_quick_push (gimple, *stmts_to_replace, stmt); + pattern_stmt = (* vect_recog_func) (stmts_to_replace, &type_in, &type_out); if (!pattern_stmt) return; - stmt = VEC_last (gimple, stmts_to_replace); + stmt = VEC_last (gimple, *stmts_to_replace); stmt_info = vinfo_for_stmt (stmt); loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info); @@ -1363,8 +1364,8 @@ vect_pattern_recog_1 ( /* It is possible that additional pattern stmts are created and inserted in STMTS_TO_REPLACE. We create a stmt_info for each of them, and mark the relevant statements. */ - for (i = 0; VEC_iterate (gimple, stmts_to_replace, i, stmt) - && (unsigned) i < (VEC_length (gimple, stmts_to_replace) - 1); + for (i = 0; VEC_iterate (gimple, *stmts_to_replace, i, stmt) + && (unsigned) i < (VEC_length (gimple, *stmts_to_replace) - 1); i++) { stmt_info = vinfo_for_stmt (stmt); @@ -1377,8 +1378,6 @@ vect_pattern_recog_1 ( vect_mark_pattern_stmts (stmt, pattern_stmt, NULL_TREE); } - - VEC_free (gimple, heap, stmts_to_replace); } @@ -1468,6 +1467,7 @@ vect_pattern_recog (loop_vec_info loop_vinfo) gimple_stmt_iterator si; unsigned int i, j; gimple (* vect_recog_func_ptr) (VEC (gimple, heap) **, tree *, tree *); + VEC (gimple, heap) *stmts_to_replace = VEC_alloc (gimple, heap, 1); if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "=== vect_pattern_recog ==="); @@ -1483,8 +1483,11 @@ vect_pattern_recog (loop_vec_info loop_vinfo) for (j = 0; j < NUM_PATTERNS; j++) { vect_recog_func_ptr = vect_vect_recog_func_ptrs[j]; - vect_pattern_recog_1 (vect_recog_func_ptr, si); + vect_pattern_recog_1 (vect_recog_func_ptr, si, + &stmts_to_replace); } } } + + VEC_free (gimple, heap, stmts_to_replace); } |