summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-03-25 09:44:25 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-03-25 09:44:25 +0000
commita2c22c0dc92f13b42490c3f180f7bd96dbf446b1 (patch)
tree566436d6b91c9959a729dc11c6aeda2161a60620
parent10836fcce806e5fcb060ef2fa7eb2ca29580fbd4 (diff)
downloadgcc-a2c22c0dc92f13b42490c3f180f7bd96dbf446b1.tar.gz
2013-03-25 Richard Biener <rguenther@suse.de>
* tree-ssa-loop-im.c (struct depend): Remove. (struct lim_aux_data): Make depends a vec of gimples. (free_lim_aux_data): Adjust. (add_dependency): Likewise. (set_level): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197031 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/tree-ssa-loop-im.c40
2 files changed, 19 insertions, 29 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 31a026a2d1a..264dd092338 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2013-03-25 Richard Biener <rguenther@suse.de>
+ * tree-ssa-loop-im.c (struct depend): Remove.
+ (struct lim_aux_data): Make depends a vec of gimples.
+ (free_lim_aux_data): Adjust.
+ (add_dependency): Likewise.
+ (set_level): Likewise.
+
+2013-03-25 Richard Biener <rguenther@suse.de>
+
PR middle-end/56434
* calls.c (expand_call): Use MALLOC_ABI_ALIGNMENT to annotate
the pointer returned by calls with ECF_MALLOC set.
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 338be75d495..182a5a46ef6 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -58,15 +58,6 @@ along with GCC; see the file COPYING3. If not see
something;
} */
-/* A type for the list of statements that have to be moved in order to be able
- to hoist an invariant computation. */
-
-struct depend
-{
- gimple stmt;
- struct depend *next;
-};
-
/* The auxiliary data kept for each statement. */
struct lim_aux_data
@@ -85,11 +76,11 @@ struct lim_aux_data
unsigned cost; /* Cost of the computation performed by the
statement. */
- struct depend *depends; /* List of statements that must be also hoisted
- out of the loop when this statement is
- hoisted; i.e. those that define the operands
- of the statement and are inside of the
- MAX_LOOP loop. */
+ vec<gimple> depends; /* Vector of statements that must be also
+ hoisted out of the loop when this statement
+ is hoisted; i.e. those that define the
+ operands of the statement and are inside of
+ the MAX_LOOP loop. */
};
/* Maps statements to their lim_aux_data. */
@@ -210,13 +201,7 @@ get_lim_data (gimple stmt)
static void
free_lim_aux_data (struct lim_aux_data *data)
{
- struct depend *dep, *next;
-
- for (dep = data->depends; dep; dep = next)
- {
- next = dep->next;
- free (dep);
- }
+ data->depends.release();
free (data);
}
@@ -481,7 +466,6 @@ add_dependency (tree def, struct lim_aux_data *data, struct loop *loop,
gimple def_stmt = SSA_NAME_DEF_STMT (def);
basic_block def_bb = gimple_bb (def_stmt);
struct loop *max_loop;
- struct depend *dep;
struct lim_aux_data *def_data;
if (!def_bb)
@@ -506,10 +490,7 @@ add_dependency (tree def, struct lim_aux_data *data, struct loop *loop,
&& def_bb->loop_father == loop)
data->cost += def_data->cost;
- dep = XNEW (struct depend);
- dep->stmt = def_stmt;
- dep->next = data->depends;
- data->depends = dep;
+ data->depends.safe_push (def_stmt);
return true;
}
@@ -872,8 +853,9 @@ static void
set_level (gimple stmt, struct loop *orig_loop, struct loop *level)
{
struct loop *stmt_loop = gimple_bb (stmt)->loop_father;
- struct depend *dep;
struct lim_aux_data *lim_data;
+ gimple dep_stmt;
+ unsigned i;
stmt_loop = find_common_loop (orig_loop, stmt_loop);
lim_data = get_lim_data (stmt);
@@ -887,8 +869,8 @@ set_level (gimple stmt, struct loop *orig_loop, struct loop *level)
|| flow_loop_nested_p (lim_data->max_loop, level));
lim_data->tgt_loop = level;
- for (dep = lim_data->depends; dep; dep = dep->next)
- set_level (dep->stmt, orig_loop, level);
+ FOR_EACH_VEC_ELT (lim_data->depends, i, dep_stmt)
+ set_level (dep_stmt, orig_loop, level);
}
/* Determines an outermost loop from that we want to hoist the statement STMT.