summaryrefslogtreecommitdiff
path: root/gcc/tree-affine.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-23 12:40:57 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-23 12:40:57 +0000
commit5fc88ffdd79e9915d97afa901f1e5c24ffcedef9 (patch)
treeef30b2e656f6d882ebaac0ac1bf93bba51c441f9 /gcc/tree-affine.c
parent39e126b34175e66f8e55e2d2863e49029673ff40 (diff)
downloadgcc-5fc88ffdd79e9915d97afa901f1e5c24ffcedef9.tar.gz
2011-08-23 Richard Guenther <rguenther@suse.de>
* Makefile.in (tree-data-ref.o): Add tree-affine.h dependency. * tree-affine.h (aff_comb_cannot_overlap_p): Declare. * tree-affine.c (aff_comb_cannot_overlap_p): New function, moved from ... * tree-ssa-loop-im.c (cannot_overlap_p): ... here. (mem_refs_may_alias_p): Adjust. * tree-data-ref.h (dr_may_alias_p): Adjust. * tree-data-ref.c: Include tree-affine.h. (dr_analyze_indices): Do nothing for the non-loop case. (dr_may_alias_p): Distinguish loop and non-loop case. Disambiguate more cases in the non-loop case. * graphite-sese-to-poly.c (write_alias_graph_to_ascii_dimacs): Adjust calls to dr_may_alias_p. (write_alias_graph_to_ascii_ecc): Likewise. (write_alias_graph_to_ascii_dot): Likewise. (build_alias_set_optimal_p): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177986 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-affine.c')
-rw-r--r--gcc/tree-affine.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/tree-affine.c b/gcc/tree-affine.c
index 06b7f2659da..69cce2e7e61 100644
--- a/gcc/tree-affine.c
+++ b/gcc/tree-affine.c
@@ -887,3 +887,30 @@ get_inner_reference_aff (tree ref, aff_tree *addr, double_int *size)
*size = shwi_to_double_int ((bitsize + BITS_PER_UNIT - 1) / BITS_PER_UNIT);
}
+/* Returns true if a region of size SIZE1 at position 0 and a region of
+ size SIZE2 at position DIFF cannot overlap. */
+
+bool
+aff_comb_cannot_overlap_p (aff_tree *diff, double_int size1, double_int size2)
+{
+ double_int d, bound;
+
+ /* Unless the difference is a constant, we fail. */
+ if (diff->n != 0)
+ return false;
+
+ d = diff->offset;
+ if (double_int_negative_p (d))
+ {
+ /* The second object is before the first one, we succeed if the last
+ element of the second object is before the start of the first one. */
+ bound = double_int_add (d, double_int_add (size2, double_int_minus_one));
+ return double_int_negative_p (bound);
+ }
+ else
+ {
+ /* We succeed if the second object starts after the first one ends. */
+ return double_int_scmp (size1, d) <= 0;
+ }
+}
+