[llvm-commits] [PATCH] Multidimensional Array Index Delinearization Analysis

Hal Finkel hfinkel at anl.gov
Wed Sep 26 22:50:11 PDT 2012


On Wed, 26 Sep 2012 12:22:16 -0500
Hal Finkel <hfinkel at anl.gov> wrote:

> On Wed, 26 Sep 2012 16:52:48 +0200
> Tobias Grosser <tobias at grosser.es> wrote:
> 
> > On 09/26/2012 04:34 PM, Hal Finkel wrote:
> > > On Wed, 26 Sep 2012 10:10:28 +0200
> > > Tobias Grosser <tobias at grosser.es> wrote:
> > >
> > >> On 09/26/2012 12:02 AM, Hal Finkel wrote:
> > >>> I've attached an updated version of the pass. This version works
> > >>> better (several bugs have been fixed), and also includes a
> > >>> working bounds analysis.
> > >>
> > >> Hi Hal,
> > >>
> > >> I tested this one again and found it has still problems.
> > >> himeno_2.ll gives the expected output, himeno_1.ll does not.
> > >
> > > You need to run LICM first in order for case 1 to work correctly.
> > > So running opt -analyze -licm -delinearize and things are fine.
> > 
> > Would it be difficult to avoid this? The original test case had 
> > branches/loops that blocked LICM. (If needed, I could provide a
> > test case where -licm does not perform a transformation).
> 
> I've attached an updated patch. Using SE's loop-invariance check (as a
> backup to LoopInfo's) was sufficient to fix the problem in this case.
> Please see if it helps in your other tests as well.

I've attached an updated patch which should be able to handled nested
allocations. Specifically, if the pointer itself is loop dependent, then
the dimension size can be dependent at the same loop depth. For example:

extern void bar(long n, long m, double A[n][m]);

void foo(long a, long b) {
  for (long n = 1; n < a; ++n)
  for (long m = 1; m < b; ++m) {
    double A[n][m];
    for (long i = 0; i < n; i++)
      for (long j = 0; j < m; j++)
        A[i][j] = 1.0;
    bar(n, m, A);
  }
}

 -Hal

> 
> Thanks again,
> Hal
> 
> > 
> > Cheers
> > Tobi
> > 
> 
> 
> 



-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Delinearization-20120926-2.patch
Type: text/x-patch
Size: 81897 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120927/9dd7de67/attachment.bin>


More information about the llvm-commits mailing list