Commit 3c62a7fb by Bin Cheng Committed by Bin Cheng

tree-predcom.c (ref_at_iteration): Add parameter NITERS.

	* tree-predcom.c (ref_at_iteration): Add parameter NITERS.  Compute
	memory reference to DR at (NITERS + ITERS)-th iteration of loop.

From-SVN: r250667
parent aa4de160
2017-07-28 Bin Cheng <bin.cheng@arm.com> 2017-07-28 Bin Cheng <bin.cheng@arm.com>
* tree-predcom.c (ref_at_iteration): Add parameter NITERS. Compute
memory reference to DR at (NITERS + ITERS)-th iteration of loop.
2017-07-28 Bin Cheng <bin.cheng@arm.com>
* tree-predcom.c (struct chain): New field init_seq. * tree-predcom.c (struct chain): New field init_seq.
(release_chain): Release init_seq. (release_chain): Release init_seq.
(prepare_initializers_chain): Record intialization stmts in above (prepare_initializers_chain): Record intialization stmts in above
......
...@@ -1370,11 +1370,12 @@ replace_ref_with (gimple *stmt, tree new_tree, bool set, bool in_lhs) ...@@ -1370,11 +1370,12 @@ replace_ref_with (gimple *stmt, tree new_tree, bool set, bool in_lhs)
gsi_insert_after (&bsi, new_stmt, GSI_NEW_STMT); gsi_insert_after (&bsi, new_stmt, GSI_NEW_STMT);
} }
/* Returns a memory reference to DR in the ITER-th iteration of /* Returns a memory reference to DR in the (NITERS + ITER)-th iteration
the loop it was analyzed in. Append init stmts to STMTS. */ of the loop it was analyzed in. Append init stmts to STMTS. */
static tree static tree
ref_at_iteration (data_reference_p dr, int iter, gimple_seq *stmts) ref_at_iteration (data_reference_p dr, int iter,
gimple_seq *stmts, tree niters = NULL_TREE)
{ {
tree off = DR_OFFSET (dr); tree off = DR_OFFSET (dr);
tree coff = DR_INIT (dr); tree coff = DR_INIT (dr);
...@@ -1383,14 +1384,27 @@ ref_at_iteration (data_reference_p dr, int iter, gimple_seq *stmts) ...@@ -1383,14 +1384,27 @@ ref_at_iteration (data_reference_p dr, int iter, gimple_seq *stmts)
tree ref_type = NULL_TREE; tree ref_type = NULL_TREE;
tree ref_op1 = NULL_TREE; tree ref_op1 = NULL_TREE;
tree ref_op2 = NULL_TREE; tree ref_op2 = NULL_TREE;
if (iter == 0) tree new_offset;
;
else if (TREE_CODE (DR_STEP (dr)) == INTEGER_CST) if (iter != 0)
coff = size_binop (PLUS_EXPR, coff, {
size_binop (MULT_EXPR, DR_STEP (dr), ssize_int (iter))); new_offset = size_binop (MULT_EXPR, DR_STEP (dr), ssize_int (iter));
if (TREE_CODE (new_offset) == INTEGER_CST)
coff = size_binop (PLUS_EXPR, coff, new_offset);
else else
off = size_binop (PLUS_EXPR, off, off = size_binop (PLUS_EXPR, off, new_offset);
size_binop (MULT_EXPR, DR_STEP (dr), ssize_int (iter))); }
if (niters != NULL_TREE)
{
niters = fold_convert (ssizetype, niters);
new_offset = size_binop (MULT_EXPR, DR_STEP (dr), niters);
if (TREE_CODE (niters) == INTEGER_CST)
coff = size_binop (PLUS_EXPR, coff, new_offset);
else
off = size_binop (PLUS_EXPR, off, new_offset);
}
/* While data-ref analysis punts on bit offsets it still handles /* While data-ref analysis punts on bit offsets it still handles
bitfield accesses at byte boundaries. Cope with that. Note that bitfield accesses at byte boundaries. Cope with that. Note that
if the bitfield object also starts at a byte-boundary we can simply if the bitfield object also starts at a byte-boundary we can simply
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment