This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix a problem in examination of may-alias sets with partitions
- From: Ira Rosen <IRAR at il dot ibm dot com>
- To: Ira Rosen <IRAR at il dot ibm dot com>
- Cc: gcc-patches at gnu dot org
- Date: Wed, 31 Jan 2007 15:42:35 +0200
- Subject: Re: [patch] Fix a problem in examination of may-alias sets with partitions
Daniel's "Change may_aliases to use bitmaps" patch fixed this problem.
There is no need in my patch anymore.
I committed the fix to vect-37.c as obvious.
Thanks,
Ira
Ira Rosen/Haifa/IBM wrote on 15/01/2007 15:14:43:
> In function is_aliased_with (tree-ssa-alias.c) every entry of tag's
> may-alias set is compared to a given symbol to find out whether this
> symbol belongs to the may-alias set. Since MEM-SSA has been merged,
> may-alias set can also contain MPTs. Therefore, we now also have to
> check whether the symbol belongs to one of the MPTs of the may-alias set.
>
> The testcases vect-37.c, vect-57.c and vect-61.c are supposed not to
> get vectorized because of aliasing. With MEM-SSA, NMTs' may-alias
> sets in these tests contain MPTs, causing is_aliased_with() return a
> wrong answer, and, therefore, causing vectorization of the loops in
> the tests. Currently, vect-57.c and vect-61.c xpass. vect-37.c was
> changed to expect pass in the MEM-SSA merge. This patch will restore
> the original behavior of vect-37.c and will make vect-57.c and
> vect-61.c to fail as they should.
>
> Bootstrapped and tested on ppc-linux.
>
> O.K. for mainline?
>
> Thanks,
> Ira
>
> ChangeLog entry:
>
> * tree-ssa-alias.c (is_aliased_with): Check if the symbol belongs
> to MPTs of the may-alias set.
>
> The patch:
>
> Index: tree-ssa-alias.c
> ===================================================================
> *** tree-ssa-alias.c (revision 120765)
> --- tree-ssa-alias.c (working copy)
> *************** is_aliased_with (tree tag, tree sym)
> *** 2591,2598 ****
> return false;
>
> for (i = 0; VEC_iterate (tree, aliases, i, al); i++)
> ! if (al == sym)
> ! return true;
> }
> else
> {
> --- 2591,2602 ----
> return false;
> for (i = 0; VEC_iterate (tree, aliases, i, al); i++)
> ! {
> ! if ((al == sym)
> ! || (TREE_CODE (al) == MEMORY_PARTITION_TAG
> ! && memory_partition (sym) == al))
> ! return true;
> ! }
> }
> else
> {
> *************** is_aliased_with (tree tag, tree sym)
> *** 2602,2614 ****
> return false;
>
> for (i = 0; VEC_iterate (tree, aliases, i, al); i++)
> ! if (al == tag)
> return true;
> }
>
> return false;
> }
>
> /* The following is based on code in add_stmt_operand to ensure that
the
> same defs/uses/vdefs/vuses will be found after replacing a reference
> to var (or ARRAY_REF to var) with an INDIRECT_REF to ptr whose value
> --- 2606,2649 ----
> return false;
>
> for (i = 0; VEC_iterate (tree, aliases, i, al); i++)
> ! if (al == tag
> ! || (TREE_CODE (al) == MEMORY_PARTITION_TAG
> ! && memory_partition (tag) == al))
> return true;
> }
>
> return false;
> }
> Index: testsuite/gcc.dg/vect/vect-37.c
> ===================================================================
> *** testsuite/gcc.dg/vect/vect-37.c (revision 120765)
> --- testsuite/gcc.dg/vect/vect-37.c (working copy)
> *************** int main (void)
> *** 53,57 ****
> return main1 (x);
> }
>
> ! /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } }
*/
> /* { dg-final { cleanup-tree-dump "vect" } } */
> --- 53,61 ----
> return main1 (x);
> }
>
> ! /* Currently the loops fail to vectorize due to aliasing problems.
> ! If/when the aliasing problems are resolved, unalignment may
> ! prevent vectorization on some targets. */
> ! /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect"
> { xfail *-*-* } } } */
> ! /* { dg-final { scan-tree-dump-times "can't determine dependence
> between" 2 "vect" } } */
> /* { dg-final { cleanup-tree-dump "vect" } } */
>
> :ADDPATCH SSA: