This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][4.1] Fix PR28029, wrong-code with vectorization (alias)
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Daniel Berlin <dberlin at dberlin dot org>
- Date: Fri, 21 Jul 2006 14:23:49 +0200 (CEST)
- Subject: [PATCH][4.1] Fix PR28029, wrong-code with vectorization (alias)
This fixes an aliasing related vectorization bug the same way it is
(papered over?) in the mainline now.
Bootstrapped and tested on x86_64-unknown-linux-gnu for all langs + ada.
Ok for the branch?
Thanks,
Richard.
:ADDPATCH alias:
2006-07-21 Richard Guenther <rguenther@suse.de>
PR tree-optimization/28029
Backport
2006-02-15 Daniel Berlin <dberlin@dberlin.org>
* tree-ssa-alias.c (get_tmt_for): Don't handle TYPE_READONLY
specially here.
* gcc.dg/vect/pr28029.c: New testcase.
Index: tree-ssa-alias.c
===================================================================
*** tree-ssa-alias.c (revision 115643)
--- tree-ssa-alias.c (working copy)
*************** get_tmt_for (tree ptr, struct alias_info
*** 1818,1825 ****
{
struct alias_map_d *curr = ai->pointers[i];
tree curr_tag = var_ann (curr->var)->type_mem_tag;
! if (tag_set == curr->set
! && TYPE_READONLY (tag_type) == TYPE_READONLY (TREE_TYPE (curr_tag)))
{
tag = curr_tag;
break;
--- 1818,1824 ----
{
struct alias_map_d *curr = ai->pointers[i];
tree curr_tag = var_ann (curr->var)->type_mem_tag;
! if (tag_set == curr->set)
{
tag = curr_tag;
break;
*************** get_tmt_for (tree ptr, struct alias_info
*** 1856,1865 ****
pointed-to type. */
gcc_assert (tag_set == get_alias_set (tag));
- /* If PTR's pointed-to type is read-only, then TAG's type must also
- be read-only. */
- gcc_assert (TYPE_READONLY (tag_type) == TYPE_READONLY (TREE_TYPE (tag)));
-
return tag;
}
--- 1855,1860 ----
Index: testsuite/gcc.dg/vect/pr28029.c
===================================================================
*** testsuite/gcc.dg/vect/pr28029.c (revision 0)
--- testsuite/gcc.dg/vect/pr28029.c (revision 0)
***************
*** 0 ****
--- 1,13 ----
+ /* { dg-do compile } */
+
+ void multiply(float *data, const float *op, unsigned int size)
+ {
+ unsigned int i;
+ for (i=0; i<size; ++i)
+ {
+ data[i] *= op[i];
+ }
+ }
+
+ /* { dg-final { scan-tree-dump "vectorized 0 loops in function" "vect" } } */
+ /* { dg-final { cleanup-tree-dump "vect" } } */