diff options
author | Sebastian Pop <spop@codeaurora.org> | 2013-11-12 22:47:20 +0000 |
---|---|---|
committer | Sebastian Pop <spop@codeaurora.org> | 2013-11-12 22:47:20 +0000 |
commit | 5230ad61fd35d3006e7764c3152d28e2e68c288f (patch) | |
tree | d94a4ccc022bb23ad6d24274319f99a85d3ae404 /test/Analysis/Delinearization/multidim_only_ivs_3d.ll | |
parent | b8fc659c8eb36796531d55fa78cbb1957895aa9b (diff) | |
download | external_llvm-5230ad61fd35d3006e7764c3152d28e2e68c288f.zip external_llvm-5230ad61fd35d3006e7764c3152d28e2e68c288f.tar.gz external_llvm-5230ad61fd35d3006e7764c3152d28e2e68c288f.tar.bz2 |
delinearization of arrays
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194527 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/Delinearization/multidim_only_ivs_3d.ll')
-rw-r--r-- | test/Analysis/Delinearization/multidim_only_ivs_3d.ll | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/test/Analysis/Delinearization/multidim_only_ivs_3d.ll b/test/Analysis/Delinearization/multidim_only_ivs_3d.ll new file mode 100644 index 0000000..24f9583 --- /dev/null +++ b/test/Analysis/Delinearization/multidim_only_ivs_3d.ll @@ -0,0 +1,65 @@ +; RUN: opt < %s -analyze -delinearize | FileCheck %s + +; void foo(long n, long m, long o, double A[n][m][o]) { +; +; for (long i = 0; i < n; i++) +; for (long j = 0; j < m; j++) +; for (long k = 0; k < o; k++) +; A[i][j][k] = 1.0; +; } + +; AddRec: {{{%A,+,(8 * %m * %o)}<%for.i>,+,(8 * %o)}<%for.j>,+,8}<%for.k> +; CHECK: Base offset: %A +; CHECK: ArrayDecl[UnknownSize][%m][%o] with elements of sizeof(double) bytes. +; CHECK: ArrayRef[{0,+,1}<nuw><nsw><%for.i>][{0,+,1}<nuw><nsw><%for.j>][{0,+,1}<nuw><nsw><%for.k>] + +; AddRec: {{(-8 + (8 * %o) + %A),+,(8 * %m * %o)}<%for.i>,+,(8 * %o)}<%for.j> +; CHECK: Base offset: %A +; CHECK: ArrayDecl[UnknownSize][(%m * %o)] with elements of sizeof(double) bytes. +; CHECK: ArrayRef[{0,+,1}<nuw><nsw><%for.i>][{(-1 + %o),+,%o}<%for.j>] + +; AddRec: {(-8 + (8 * %m * %o) + %A),+,(8 * %m * %o)}<%for.i> +; CHECK: Base offset: %A +; CHECK: ArrayDecl[UnknownSize] with elements of sizeof(double) bytes. +; CHECK: ArrayRef[{(-1 + (%m * %o)),+,(%m * %o)}<%for.i>] + +define void @foo(i64 %n, i64 %m, i64 %o, double* %A) { +entry: + br label %for.i + +for.i: + %i = phi i64 [ 0, %entry ], [ %i.inc, %for.i.inc ] + br label %for.j + +for.j: + %j = phi i64 [ 0, %for.i ], [ %j.inc, %for.j.inc ] + br label %for.k + +for.k: + %k = phi i64 [ 0, %for.j ], [ %k.inc, %for.k.inc ] + %subscript0 = mul i64 %i, %m + %subscript1 = add i64 %j, %subscript0 + %subscript2 = mul i64 %subscript1, %o + %subscript = add i64 %subscript2, %k + %idx = getelementptr inbounds double* %A, i64 %subscript + store double 1.0, double* %idx + br label %for.k.inc + +for.k.inc: + %k.inc = add nsw i64 %k, 1 + %k.exitcond = icmp eq i64 %k.inc, %o + br i1 %k.exitcond, label %for.j.inc, label %for.k + +for.j.inc: + %j.inc = add nsw i64 %j, 1 + %j.exitcond = icmp eq i64 %j.inc, %m + br i1 %j.exitcond, label %for.i.inc, label %for.j + +for.i.inc: + %i.inc = add nsw i64 %i, 1 + %i.exitcond = icmp eq i64 %i.inc, %n + br i1 %i.exitcond, label %end, label %for.i + +end: + ret void +} |