This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][RFC] Make parameter aliasing for Fortran more efficient


On Mon, 4 Aug 2008, Richard Guenther wrote:

> 
> Currently for parameters to Fortran functions we mark them aliasing only
> theirselves by creating a heap object which they point to
> 
>  PARM_NOALIAS.594 = &ESCAPED
>  PARM_NOALIAS.594.196+196 = &ESCAPED
>  self = &PARM_NOALIAS.594
> 
> as you may notice that dereferencing self will lead to pointers pointing
> to global memory.  This of course makes parameter aliasing quite
> uneffective for array descriptors, as the actual array data is just a
> pointer in the array descriptor data...  which means the actual data
> just is in global memory and will use regular type tags.
> 
> Now, the fix is easy - just pretend Fortran arguments transitively
> point to distinct memory by doing
> 
>  PARM_NOALIAS.594 = &PARM_NOALIAS.594
>  self = &PARM_NOALIAS.594
> 
> instead.  This allows a whole bunch of optimizations in tonto at least.
> 
> Bootstrap / regtest in progress.  I'd appreciate some other Fortran
> benchmarking (and verification).

Even if this didn't improve present benchmarks it makes the PTA
results significantly more accurate for fortran parameters.

To recap, for

subroutine to_product_of(self,a,b,a1,a2)
  complex(kind=8) :: self (:)
  complex(kind=8), intent(in) :: a(:,:)
  complex(kind=8), intent(in) :: b(:)
  integer a1,a2
  self = ZERO
  do i = 1,a1
  do j = 1,a2
  self(i) = self(i) + a(i,j)*b(j)
  end do
  end do
end subroutine

we after the patch correctly see that the array accesses to self,
a and b do not alias:

-  # VUSE <PARM_NOALIAS.33_110, PARM_NOALIAS.34_114, PARM_NOALIAS.35_118, 
PARM_N
OALIAS.36_122, PARM_NOALIAS.37_126, SMT.41_130>
+  # VUSE <PARM_NOALIAS.33_110>
   D.1639_89 = (*self.0_13)[D.1638_88];
...
-  # VUSE <PARM_NOALIAS.33_110, PARM_NOALIAS.34_114, PARM_NOALIAS.35_118, 
PARM_NOALIAS.36_122, PARM_NOALIAS.37_126, SMT.41_130>
+  # VUSE <PARM_NOALIAS.34_112(D)>
   D.1645_96 = (*a.0_31)[D.1644_95];
...
-  # PARM_NOALIAS.33_143 = VDEF <PARM_NOALIAS.33_110>
-  # PARM_NOALIAS.34_144 = VDEF <PARM_NOALIAS.34_114>
-  # PARM_NOALIAS.35_145 = VDEF <PARM_NOALIAS.35_118>
-  # PARM_NOALIAS.36_146 = VDEF <PARM_NOALIAS.36_122>
-  # PARM_NOALIAS.37_147 = VDEF <PARM_NOALIAS.37_126>
-  # SMT.41_148 = VDEF <SMT.41_130>
+  # PARM_NOALIAS.33_117 = VDEF <PARM_NOALIAS.33_110>
   (*self.0_13)[D.1638_88] = D.1650_102;

which should save both some compile-time and memory due to less
VOPs and due to increased precision of alias info may even
improve run-time for some cases.

So, I'll install this now after retesting.

Richard.

> 2008-08-04  Richard Guenther  <rguenther@suse.de>
> 
> 	* tree-ssa-structalias.c (create_variable_info_for): Do not
> 	create fields for heap vars or vars with a noalias state.
> 	For NO_ALIAS_ANYTHING variables add a self-constraint, not one
> 	from ESCAPED.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]