aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-data-ref.c
diff options
context:
space:
mode:
authorIra Rosen <irar@il.ibm.com>2005-08-14 06:28:03 +0000
committerIra Rosen <irar@gcc.gnu.org>2005-08-14 06:28:03 +0000
commit1f400bbb8f014c3259d65d03a119a49589c76348 (patch)
tree0d4d332f3475a4d9960abdcf023f02034f12da11 /gcc/tree-data-ref.c
parent7d465f1def2bcd4bfbb3dcfe2a793653b7304ed9 (diff)
downloadgcc-1f400bbb8f014c3259d65d03a119a49589c76348.zip
gcc-1f400bbb8f014c3259d65d03a119a49589c76348.tar.gz
gcc-1f400bbb8f014c3259d65d03a119a49589c76348.tar.bz2
re PR tree-optimization/23320 (ICE in in base_addr_differ_p, at tree-data-ref.c:430)
PR tree-optimization/23320 * tree-data-ref.c (base_addr_differ_p): Add comment. Check data-refs' types instead of base object nullness. Add check for pointer type data-refs before first location comparison. Remove assert. From-SVN: r103076
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r--gcc/tree-data-ref.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 7fc6424..24856ed 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -384,11 +384,18 @@ base_object_differ_p (struct data_reference *a,
/* Function base_addr_differ_p.
This is the simplest data dependence test: determines whether the
- data references A and B access the same array/region. Returns
+ data references DRA and DRB access the same array/region. Returns
false when the property is not computable at compile time.
- Otherwise return true, and DIFFER_P will record the result. This
- utility will not be necessary when alias_sets_conflict_p will be
- less conservative. */
+ Otherwise return true, and DIFFER_P will record the result.
+
+ The algorithm:
+ 1. if (both DRA and DRB are represented as arrays)
+ compare DRA.BASE_OBJECT and DRB.BASE_OBJECT
+ 2. else if (both DRA and DRB are represented as pointers)
+ try to prove that DRA.FIRST_LOCATION == DRB.FIRST_LOCATION
+ 3. else if (DRA and DRB are represented differently or 2. fails)
+ only try to prove that the bases are surely different
+*/
static bool
@@ -409,26 +416,27 @@ base_addr_differ_p (struct data_reference *dra,
gcc_assert (POINTER_TYPE_P (type_a) && POINTER_TYPE_P (type_b));
- /* Compare base objects first if possible. If DR_BASE_OBJECT is NULL, it means
- that the data-ref is of INDIRECT_REF, and alias analysis will be applied to
- reveal the dependence. */
- if (DR_BASE_OBJECT (dra) && DR_BASE_OBJECT (drb))
+ /* 1. if (both DRA and DRB are represented as arrays)
+ compare DRA.BASE_OBJECT and DRB.BASE_OBJECT. */
+ if (DR_TYPE (dra) == ARRAY_REF_TYPE && DR_TYPE (drb) == ARRAY_REF_TYPE)
return base_object_differ_p (dra, drb, differ_p);
+
+ /* 2. else if (both DRA and DRB are represented as pointers)
+ try to prove that DRA.FIRST_LOCATION == DRB.FIRST_LOCATION. */
/* If base addresses are the same, we check the offsets, since the access of
the data-ref is described by {base addr + offset} and its access function,
i.e., in order to decide whether the bases of data-refs are the same we
compare both base addresses and offsets. */
- if (addr_a == addr_b
- || (TREE_CODE (addr_a) == ADDR_EXPR && TREE_CODE (addr_b) == ADDR_EXPR
- && TREE_OPERAND (addr_a, 0) == TREE_OPERAND (addr_b, 0)))
+ if (DR_TYPE (dra) == POINTER_REF_TYPE && DR_TYPE (drb) == POINTER_REF_TYPE
+ && (addr_a == addr_b
+ || (TREE_CODE (addr_a) == ADDR_EXPR && TREE_CODE (addr_b) == ADDR_EXPR
+ && TREE_OPERAND (addr_a, 0) == TREE_OPERAND (addr_b, 0))))
{
/* Compare offsets. */
tree offset_a = DR_OFFSET (dra);
tree offset_b = DR_OFFSET (drb);
- gcc_assert (!DR_BASE_OBJECT (dra) && !DR_BASE_OBJECT (drb));
-
STRIP_NOPS (offset_a);
STRIP_NOPS (offset_b);
@@ -445,6 +453,9 @@ base_addr_differ_p (struct data_reference *dra,
}
}
+ /* 3. else if (DRA and DRB are represented differently or 2. fails)
+ only try to prove that the bases are surely different. */
+
/* Apply alias analysis. */
if (may_alias_p (addr_a, addr_b, dra, drb, &aliased) && !aliased)
{