tree-ssa-alias.h (ranges_overlap_p): Handle negative offsets.
2013-11-05 Marc Glisse <marc.glisse@inria.fr> gcc/ * tree-ssa-alias.h (ranges_overlap_p): Handle negative offsets. * tree-ssa-alias.c (ao_ref_init_from_ptr_and_size): Likewise. gcc/testsuite/ * gcc.dg/tree-ssa/alias-26.c: New file. From-SVN: r204388
This commit is contained in:
parent
3ff2ca23dc
commit
75081240d0
@ -1,3 +1,8 @@
|
||||
2013-11-05 Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
* tree-ssa-alias.h (ranges_overlap_p): Handle negative offsets.
|
||||
* tree-ssa-alias.c (ao_ref_init_from_ptr_and_size): Likewise.
|
||||
|
||||
2013-11-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/58984
|
||||
|
@ -1,3 +1,7 @@
|
||||
2013-11-05 Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
* gcc.dg/tree-ssa/alias-26.c: New file.
|
||||
|
||||
2013-11-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/58984
|
||||
|
13
gcc/testsuite/gcc.dg/tree-ssa/alias-26.c
Normal file
13
gcc/testsuite/gcc.dg/tree-ssa/alias-26.c
Normal file
@ -0,0 +1,13 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fdump-tree-optimized" } */
|
||||
|
||||
void f (const char *c, int *i)
|
||||
{
|
||||
*i = 42;
|
||||
__builtin_memcpy (i - 1, c, sizeof (int));
|
||||
if (*i != 42) __builtin_abort();
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-not "abort" "optimized" } } */
|
||||
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
||||
|
@ -559,7 +559,7 @@ ao_ref_alias_set (ao_ref *ref)
|
||||
}
|
||||
|
||||
/* Init an alias-oracle reference representation from a gimple pointer
|
||||
PTR and a gimple size SIZE in bytes. If SIZE is NULL_TREE the the
|
||||
PTR and a gimple size SIZE in bytes. If SIZE is NULL_TREE then the
|
||||
size is assumed to be unknown. The access is assumed to be only
|
||||
to or after of the pointer target, not before it. */
|
||||
|
||||
@ -576,11 +576,11 @@ ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size)
|
||||
ptr = gimple_assign_rhs1 (stmt);
|
||||
else if (is_gimple_assign (stmt)
|
||||
&& gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR
|
||||
&& host_integerp (gimple_assign_rhs2 (stmt), 0)
|
||||
&& (t1 = int_cst_value (gimple_assign_rhs2 (stmt))) >= 0)
|
||||
&& TREE_CODE (gimple_assign_rhs2 (stmt)) == INTEGER_CST)
|
||||
{
|
||||
ptr = gimple_assign_rhs1 (stmt);
|
||||
extra_offset = BITS_PER_UNIT * t1;
|
||||
extra_offset = BITS_PER_UNIT
|
||||
* int_cst_value (gimple_assign_rhs2 (stmt));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,18 +146,18 @@ extern GTY(()) struct pt_solution ipa_escaped_pt;
|
||||
range is open-ended. Otherwise return false. */
|
||||
|
||||
static inline bool
|
||||
ranges_overlap_p (unsigned HOST_WIDE_INT pos1,
|
||||
ranges_overlap_p (HOST_WIDE_INT pos1,
|
||||
unsigned HOST_WIDE_INT size1,
|
||||
unsigned HOST_WIDE_INT pos2,
|
||||
HOST_WIDE_INT pos2,
|
||||
unsigned HOST_WIDE_INT size2)
|
||||
{
|
||||
if (pos1 >= pos2
|
||||
&& (size2 == (unsigned HOST_WIDE_INT)-1
|
||||
|| pos1 < (pos2 + size2)))
|
||||
|| pos1 < (pos2 + (HOST_WIDE_INT) size2)))
|
||||
return true;
|
||||
if (pos2 >= pos1
|
||||
&& (size1 == (unsigned HOST_WIDE_INT)-1
|
||||
|| pos2 < (pos1 + size1)))
|
||||
|| pos2 < (pos1 + (HOST_WIDE_INT) size1)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user