Bug 21470 - -fargument-noalias-global has no effect for the vectorizer
Summary: -fargument-noalias-global has no effect for the vectorizer
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.1.0
: P2 enhancement
Target Milestone: 4.2.0
Assignee: Andrew Pinski
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: alias, missed-optimization, patch
Depends on: 22254 17064
  Show dependency treegraph
Reported: 2005-05-09 14:47 UTC by Thomas Koenig
Modified: 2006-01-26 17:50 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2006-01-05 14:24:58


Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Koenig 2005-05-09 14:47:45 UTC
Fortran subroutine arguments should be marked as
__restrict__.  Currently, the following code isn't

$ cat loopsum.f90
subroutine foo(a,b,c,n)
  real, dimension(n), intent(in) :: a,b
  real, dimension(n), intent(out) :: c
  do i=1,n
    c(i) = a(i)+b(i)
  end do
$ gfortran -O -S -ftree-vectorize -ftree-vectorizer-verbose=5 loopsum.f90

loopsum.f90:4: note: not vectorized: can't determine dependence between: (*a_18)
[D.527_17] and (*c_25)[D.527_17]
loopsum.f90:1: note: vectorized 0 loops in function.
$ gfortran -v
Using built-in specs.
Target: ia64-unknown-linux-gnu
Configured with: ../gcc-4.1-20050508/configure --prefix=/home/zfkts --enable-
Thread model: posix
gcc version 4.1.0 20050508 (experimental)
Comment 1 Andrew Pinski 2005-05-09 14:53:51 UTC
Actually -fargument-noalias-global is set to true for fortran and should be respected instead of 
marking them as restrict.
Comment 2 Andrew Pinski 2005-05-09 15:54:10 UTC
If the aliasing information is correct on the VOPS, I would assume that the vectorizer would not have 
problems with it.

Note there is another bug about this option, see PR 17064.
Comment 3 Andrew Pinski 2005-08-06 19:47:37 UTC
I have a fix which I need to bootstrap/test.
Comment 4 Andrew Pinski 2005-10-05 13:20:49 UTC
Talked to Daniel Berlin about the patch I had, it was in the wrong spot, I had it in the post process and not when analyzing the code.  So unassigning for now.
Comment 5 Andrew Pinski 2006-01-10 20:31:01 UTC
I have a fix which comes from Richard Guenther and modified for -fargument-noalias-global instead of restrict as it was using the wrong test.
Comment 6 Andrew Pinski 2006-01-16 17:09:21 UTC
Patch posted: http://gcc.gnu.org/ml/gcc-patches/2006-01/msg00864.html
Comment 7 Andrew Pinski 2006-01-26 17:50:15 UTC
Fixed applied.
Comment 8 Andrew Pinski 2006-01-26 17:51:28 UTC
Subject: Bug 21470

Author: pinskia
Date: Thu Jan 26 17:51:25 2006
New Revision: 110263

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110263
2006-01-26  Richard Guenther  <rguenther@suse.de>
            Andrew Pinski  <pinskia@physics.uc.edu>

        PR tree-opt/21470
        partial PR tree-opt/17064
        * tree-ssa-structalias.c (intra_create_variable_infos):
        Create heap variables for incoming parameters if
        flag_argument_noalias > 1.
        (find_what_p_points_to): Look through default defs of
        parameter decls.