From: Richard Sandiford Date: Thu, 21 Apr 2011 09:39:57 +0000 (+0000) Subject: tree-vect-data-refs.c (vect_drs_dependent_in_basic_block): Use operand_equal_p to... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0b5a27249aa584eb385d9146d94ef1067241e155;p=gcc.git tree-vect-data-refs.c (vect_drs_dependent_in_basic_block): Use operand_equal_p to compare DR_BASE_ADDRESSes. gcc/ * tree-vect-data-refs.c (vect_drs_dependent_in_basic_block): Use operand_equal_p to compare DR_BASE_ADDRESSes. (vect_check_interleaving): Likewise. gcc/testsuite/ * gcc.dg/vect/vect-119.c: New test. From-SVN: r172817 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ec65ff12d95..028e230f4f6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-04-21 Richard Sandiford + + * tree-vect-data-refs.c (vect_drs_dependent_in_basic_block): Use + operand_equal_p to compare DR_BASE_ADDRESSes. + (vect_check_interleaving): Likewise. + 2011-04-21 Richard Sandiford PR target/46329 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7cda82e187b..5917c5ba638 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-04-21 Richard Sandiford + + * gcc.dg/vect/vect-119.c: New test. + 2011-04-21 Richard Sandiford * gcc.dg/vect/vect.exp: Run the main tests twice, one with -flto diff --git a/gcc/testsuite/gcc.dg/vect/vect-119.c b/gcc/testsuite/gcc.dg/vect/vect-119.c new file mode 100644 index 00000000000..fa40f15c934 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-119.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ + +#define OUTER 32 +#define INNER 40 + +static unsigned int +bar (const unsigned int x[INNER][2], unsigned int sum) +{ + int i; + + for (i = 0; i < INNER; i++) + sum += x[i][0] * x[i][0] + x[i][1] * x[i][1]; + return sum; +} + +unsigned int foo (const unsigned int x[OUTER][INNER][2]) +{ + int i; + unsigned int sum; + + sum = 0.0f; + for (i = 0; i < OUTER; i++) + sum = bar (x[i], sum); + return sum; +} + +/* { dg-final { scan-tree-dump-times "Detected interleaving of size 2" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index d7d174fbba2..9ce4626f4b1 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -314,11 +314,7 @@ vect_drs_dependent_in_basic_block (struct data_reference *dra, /* Check that the data-refs have same bases and offsets. If not, we can't determine if they are dependent. */ - if ((DR_BASE_ADDRESS (dra) != DR_BASE_ADDRESS (drb) - && (TREE_CODE (DR_BASE_ADDRESS (dra)) != ADDR_EXPR - || TREE_CODE (DR_BASE_ADDRESS (drb)) != ADDR_EXPR - || TREE_OPERAND (DR_BASE_ADDRESS (dra), 0) - != TREE_OPERAND (DR_BASE_ADDRESS (drb),0))) + if (!operand_equal_p (DR_BASE_ADDRESS (dra), DR_BASE_ADDRESS (drb), 0) || !dr_equal_offsets_p (dra, drb)) return true; @@ -364,11 +360,7 @@ vect_check_interleaving (struct data_reference *dra, /* Check that the data-refs have same first location (except init) and they are both either store or load (not load and store). */ - if ((DR_BASE_ADDRESS (dra) != DR_BASE_ADDRESS (drb) - && (TREE_CODE (DR_BASE_ADDRESS (dra)) != ADDR_EXPR - || TREE_CODE (DR_BASE_ADDRESS (drb)) != ADDR_EXPR - || TREE_OPERAND (DR_BASE_ADDRESS (dra), 0) - != TREE_OPERAND (DR_BASE_ADDRESS (drb),0))) + if (!operand_equal_p (DR_BASE_ADDRESS (dra), DR_BASE_ADDRESS (drb), 0) || !dr_equal_offsets_p (dra, drb) || !tree_int_cst_compare (DR_INIT (dra), DR_INIT (drb)) || DR_IS_READ (dra) != DR_IS_READ (drb))