summaryrefslogtreecommitdiff
path: root/gcc/tree-data-ref.c
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-24 16:09:26 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-24 16:09:26 +0000
commitad4a85adaf8f60f25f7c67c0f82be6a75db3ef81 (patch)
treeefa71ea8cb7294c745a8a90f9749d81cacc971df /gcc/tree-data-ref.c
parent7b613d123519e4abd493296775a6da2b6f7e97a7 (diff)
downloadgcc-ad4a85adaf8f60f25f7c67c0f82be6a75db3ef81.tar.gz
* doc/passes.texi: Document predictive commoning.
* doc/invoke.texi (-fpredictive-commoning): Document. * opts.c (decode_options): Enable flag_predictive_commoning on -O3. * tree-ssa-loop-im.c (get_lsm_tmp_name): Export. Allow adding indices to the generated name. (schedule_sm): Pass 0 to get_lsm_tmp_name. * tree-ssa-loop-niter.c (stmt_dominates_stmt_p): Export. * tree-pretty-print.c (op_symbol_1): Renamed to ... (op_symbol_code): ... and exported. (dump_omp_clause, op_symbol): Use op_symbol_code instead of op_symbol_1. * tree-pass.h (pass_predcom): Declare. * timevar.def (TV_PREDCOM): New timevar. * tree-ssa-loop.c (run_tree_predictive_commoning, gate_tree_predictive_commoning, pass_predcom): New. * tree-data-ref.c (find_data_references_in_loop): Find the references in dominance order. (canonicalize_base_object_address): Ensure that the result has pointer type. (dr_analyze_innermost): Export. (create_data_ref): Code to fail for references with invariant address moved ... (find_data_references_in_stmt): ... here. * tree-data-ref.h (dr_analyze_innermost): Declare. * tree-affine.c: Include tree-gimple.h and hashtab.h. (aff_combination_find_elt, name_expansion_hash, name_expansion_eq, tree_to_aff_combination_expand, double_int_constant_multiple_p, aff_combination_constant_multiple_p): New functions. * tree-affine.h (aff_combination_constant_multiple_p, tree_to_aff_combination_expand): Declare. * tree-predcom.c: New file. * common.opt (fpredictive-commoning): New option. * tree-flow.h (op_symbol_code, tree_predictive_commoning, stmt_dominates_stmt_p, get_lsm_tmp_name): Declare. * Makefile.in (tree-predcom.o): Add. (tree-affine.o): Add TREE_GIMPLE_H dependency. * passes.c (init_optimization_passes): Add dceloop after copy propagation in loop optimizer. Add predictive commoning to loop optimizer passes. * gcc.dg/tree-ssa/predcom-1.c: New test. * gcc.dg/tree-ssa/predcom-2.c: New test. * gcc.dg/tree-ssa/predcom-3.c: New test. * gcc.dg/tree-ssa/predcom-4.c: New test. * gcc.dg/tree-ssa/predcom-5.c: New test. * gcc.dg/vect/dump-tree-dceloop-pr26359.c: Test dceloop2 dumps. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125030 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r--gcc/tree-data-ref.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 6fa59e8a299..ce0b3fe52f9 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -573,8 +573,15 @@ split_constant_offset (tree exp, tree *var, tree *off)
static tree
canonicalize_base_object_address (tree addr)
{
+ tree orig = addr;
+
STRIP_NOPS (addr);
+ /* The base address may be obtained by casting from integer, in that case
+ keep the cast. */
+ if (!POINTER_TYPE_P (TREE_TYPE (addr)))
+ return orig;
+
if (TREE_CODE (addr) != ADDR_EXPR)
return addr;
@@ -584,7 +591,7 @@ canonicalize_base_object_address (tree addr)
/* Analyzes the behavior of the memory reference DR in the innermost loop that
contains it. */
-static void
+void
dr_analyze_innermost (struct data_reference *dr)
{
tree stmt = DR_STMT (dr);
@@ -804,16 +811,6 @@ create_data_ref (struct loop *nest, tree memref, tree stmt, bool is_read)
fprintf (dump_file, "\n");
}
- /* FIXME -- data dependence analysis does not work correctly for objects with
- invariant addresses. Let us fail here until the problem is fixed. */
- if (dr_address_invariant_p (dr))
- {
- free_data_ref (dr);
- dr = NULL;
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, "\tFAILED as dr address is invariant\n");
- }
-
return dr;
}
@@ -3965,13 +3962,20 @@ find_data_references_in_stmt (struct loop *nest, tree stmt,
for (i = 0; VEC_iterate (data_ref_loc, references, i, ref); i++)
{
dr = create_data_ref (nest, *ref->pos, stmt, ref->is_read);
- if (dr)
- VEC_safe_push (data_reference_p, heap, *datarefs, dr);
- else
+ gcc_assert (dr != NULL);
+
+ /* FIXME -- data dependence analysis does not work correctly for objects with
+ invariant addresses. Let us fail here until the problem is fixed. */
+ if (dr_address_invariant_p (dr))
{
+ free_data_ref (dr);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\tFAILED as dr address is invariant\n");
ret = false;
break;
}
+
+ VEC_safe_push (data_reference_p, heap, *datarefs, dr);
}
VEC_free (data_ref_loc, heap, references);
return ret;
@@ -3992,7 +3996,7 @@ find_data_references_in_loop (struct loop *loop,
unsigned int i;
block_stmt_iterator bsi;
- bbs = get_loop_body (loop);
+ bbs = get_loop_body_in_dom_order (loop);
for (i = 0; i < loop->num_nodes; i++)
{