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

Tobias Grosser tobias at grosser.es
Tue Sep 25 02:21:16 PDT 2012


On 09/24/2012 06:57 AM, Hal Finkel wrote:
> Hello,
>
> I've attached an initial version of an analysis pass for
> delinearization of multidimensional array accesses. Specifically, this
> means the following:
> Additional test cases will also be helpful.

I think the himeno benchmark would be great to extract test cases. It is 
relatively small and is a perfect example of manually crafted variable 
length arrays.

I attached the c version as well as the output of the following operations:

$ clang -O0 himenobmtxpa.c -S -emit-llvm -o himenobmtxpa.ll
$ llvm-extract -func=jacobi himenobmtxpa.ll -S > jacobi.ll
$ opt -O3 jacobi.ll -S > jacobi.opt.ll

$ opt -delinearize jacobi.ll -analyze
Printing analysis 'Delinearization' for function 'jacobi':

$ opt -delinearize jacobi.opt.ll -analyze
Printing analysis 'Delinearization' for function 'jacobi':
add35.us: dim: 0, size: (-1 + (sext i32 (-1 + %2) to i64)), index: 
((sext i32 %9 to i64) * (((sext i32 %8 to i64) * 
{1,+,1}<nuw><nsw><%for.cond11.preheader>) + 
{1,+,1}<nuw><nsw><%for.inc59.us>)), confirmed: 0
add35.us: dim: 1, size: 1, index: 1, confirmed: 0
add55.us: dim: 0, size: (-1 + (sext i32 (-1 + %2) to i64)), index: 
{{((sext i32 %2 to i64) * (1 + (2 * (sext i32 %1 to i64)))),+,((sext i32 
%2 to i64) * (sext i32 %1 to i64))}<%for.cond11.preheader>,+,(sext i32 
%2 to i64)}<%for.inc59.us>, confirmed: 0
add55.us: dim: 1, size: 1, index: 1, confirmed: 0

It seems your analysis has still problems to perform delinearization 
here. Do you understand why?

Cheers
Tobi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: himenobmtxpa.c
Type: text/x-csrc
Size: 7460 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120925/a2d3f644/attachment.c>


More information about the llvm-commits mailing list