summaryrefslogtreecommitdiffstats
path: root/polly/test/JSONExporter/ImportAccesses
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2017-05-24 15:09:35 +0000
committerMichael Kruse <llvm@meinersbur.de>2017-05-24 15:09:35 +0000
commitcb58bd6ccdf9d2bbbf021599c92a74f776feee40 (patch)
tree2d95a1b76ec1890dd9a8e71ea20971a95037c6d9 /polly/test/JSONExporter/ImportAccesses
parentb07351f4f87ff31373bd5d8321569736117a7c90 (diff)
downloadbcm5719-llvm-cb58bd6ccdf9d2bbbf021599c92a74f776feee40.tar.gz
bcm5719-llvm-cb58bd6ccdf9d2bbbf021599c92a74f776feee40.zip
[JSONImporter] misses checks whether the data it imports makes sense.
Without this patch, the JSONImporter did not verify if the data it loads were correct or not (Bug llvm.org/PR32543). I add some checks in the JSONImporter class and some test cases. Here are the checks (and test cases) I added : JSONImporter::importContext - The "context" key does not exist. - The context was not parsed successfully by ISL. - The isl_set has the wrong number of parameters. - The isl_set is not a parameter set. JSONImporter::importSchedule - The "statements" key does not exist. - There is not the right number of statement in the file. - The "schedule" key does not exist. - The schedule was not parsed successfully by ISL. JSONImporter::importAccesses - The "statements" key does not exist. - There is not the right number of statement in the file. - The "accesses" key does not exist. - There is not the right number of memory accesses in the file. - The "relation" key does not exist. - The memory access was not parsed successfully by ISL. JSONImporter::areArraysEqual - The "type" key does not exist. - The "sizes" key does not exist. - The "name" key does not exist. JSONImporter::importArrays /!\ Do not check if there is an key name "arrays" because it is not considered as an error. All checks are already in place or implemented in JSONImporter::areArraysEqual. Contributed-by: Nicolas Bonfante <nicolas.bonfante@insa-lyon.fr> Differential Revision: https://reviews.llvm.org/D32739 llvm-svn: 303759
Diffstat (limited to 'polly/test/JSONExporter/ImportAccesses')
-rw-r--r--polly/test/JSONExporter/ImportAccesses/ImportAccesses-Bad-relation.ll64
-rw-r--r--polly/test/JSONExporter/ImportAccesses/ImportAccesses-No-accesses-key.ll64
-rw-r--r--polly/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-MemAcc.ll64
-rw-r--r--polly/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-statements.ll64
-rw-r--r--polly/test/JSONExporter/ImportAccesses/ImportAccesses-Relation-mispelled.ll64
-rw-r--r--polly/test/JSONExporter/ImportAccesses/ImportAccesses-Statements-mispelled.ll64
-rw-r--r--polly/test/JSONExporter/ImportAccesses/ImportAccesses-Undeclared-ScopArrayInfo.ll64
-rw-r--r--polly/test/JSONExporter/ImportAccesses/ImportAccesses-Wrong-number-dimensions.ll64
-rw-r--r--polly/test/JSONExporter/ImportAccesses/ia2___%for.cond---%for.end10.jscop21
-rw-r--r--polly/test/JSONExporter/ImportAccesses/ia3___%for.cond---%for.end10.jscop26
-rw-r--r--polly/test/JSONExporter/ImportAccesses/ia4___%for.cond---%for.end10.jscop28
-rw-r--r--polly/test/JSONExporter/ImportAccesses/ia5___%for.cond---%for.end10.jscop31
-rw-r--r--polly/test/JSONExporter/ImportAccesses/ia6___%for.cond---%for.end10.jscop32
-rw-r--r--polly/test/JSONExporter/ImportAccesses/ia7___%for.cond---%for.end10.jscop32
-rw-r--r--polly/test/JSONExporter/ImportAccesses/ia8___%for.cond---%for.end10.jscop32
-rw-r--r--polly/test/JSONExporter/ImportAccesses/ia___%for.cond---%for.end10.jscop32
16 files changed, 746 insertions, 0 deletions
diff --git a/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Bad-relation.ll b/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Bad-relation.ll
new file mode 100644
index 00000000000..d13df021011
--- /dev/null
+++ b/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Bad-relation.ll
@@ -0,0 +1,64 @@
+; RUN: opt %loadPolly -polly-import-jscop-dir=%S -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
+;
+; CHECK: The access was not parsed successfully by ISL.
+;
+; Verify that the JSONImporter checks if the relation is valid.
+;
+; void ia6(int *A, long n) {
+; for (long i = 0; i < 2 * n; i++)
+; S0: A[0] += i;
+; for (long i = 0; i < 2 * n; i++)
+; S1: A[i + 1] = 1;
+; }
+;
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
+
+define void @ia6(i32* %A, i32 %n) {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
+ %mul = shl nsw i32 %n, 1
+ %cmp = icmp slt i32 %i.0, %mul
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ br label %S0
+
+S0: ; preds = %for.body
+ %tmp = load i32, i32* %A, align 4
+ %add = add nsw i32 %tmp, %i.0
+ store i32 %add, i32* %A, align 4
+ br label %for.inc
+
+for.inc: ; preds = %S0
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ br label %for.cond2
+
+for.cond2: ; preds = %for.inc8, %for.end
+ %i1.0 = phi i32 [ 0, %for.end ], [ %inc9, %for.inc8 ]
+ %mul3 = shl nsw i32 %n, 1
+ %cmp4 = icmp slt i32 %i1.0, %mul3
+ br i1 %cmp4, label %for.body5, label %for.end10
+
+for.body5: ; preds = %for.cond2
+ br label %S1
+
+S1: ; preds = %for.body5
+ %add6 = add nsw i32 %i1.0, 1
+ %arrayidx7 = getelementptr inbounds i32, i32* %A, i32 %add6
+ store i32 1, i32* %arrayidx7, align 4
+ br label %for.inc8
+
+for.inc8: ; preds = %S1
+ %inc9 = add nsw i32 %i1.0, 1
+ br label %for.cond2
+
+for.end10: ; preds = %for.cond2
+ ret void
+}
+
diff --git a/polly/test/JSONExporter/ImportAccesses/ImportAccesses-No-accesses-key.ll b/polly/test/JSONExporter/ImportAccesses/ImportAccesses-No-accesses-key.ll
new file mode 100644
index 00000000000..6ddeba36336
--- /dev/null
+++ b/polly/test/JSONExporter/ImportAccesses/ImportAccesses-No-accesses-key.ll
@@ -0,0 +1,64 @@
+; RUN: opt %loadPolly -polly-import-jscop-dir=%S -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
+;
+; CHECK: Statement from JScop file has no key name 'accesses' for index 1.
+;
+; Verify that the JSONImporter checks if there is a key name "accesses" for each statement.
+;
+; void ia3(int *A, long n) {
+; for (long i = 0; i < 2 * n; i++)
+; S0: A[0] += i;
+; for (long i = 0; i < 2 * n; i++)
+; S1: A[i + 1] = 1;
+; }
+;
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
+
+define void @ia3(i32* %A, i32 %n) {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
+ %mul = shl nsw i32 %n, 1
+ %cmp = icmp slt i32 %i.0, %mul
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ br label %S0
+
+S0: ; preds = %for.body
+ %tmp = load i32, i32* %A, align 4
+ %add = add nsw i32 %tmp, %i.0
+ store i32 %add, i32* %A, align 4
+ br label %for.inc
+
+for.inc: ; preds = %S0
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ br label %for.cond2
+
+for.cond2: ; preds = %for.inc8, %for.end
+ %i1.0 = phi i32 [ 0, %for.end ], [ %inc9, %for.inc8 ]
+ %mul3 = shl nsw i32 %n, 1
+ %cmp4 = icmp slt i32 %i1.0, %mul3
+ br i1 %cmp4, label %for.body5, label %for.end10
+
+for.body5: ; preds = %for.cond2
+ br label %S1
+
+S1: ; preds = %for.body5
+ %add6 = add nsw i32 %i1.0, 1
+ %arrayidx7 = getelementptr inbounds i32, i32* %A, i32 %add6
+ store i32 1, i32* %arrayidx7, align 4
+ br label %for.inc8
+
+for.inc8: ; preds = %S1
+ %inc9 = add nsw i32 %i1.0, 1
+ br label %for.cond2
+
+for.end10: ; preds = %for.cond2
+ ret void
+}
+
diff --git a/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-MemAcc.ll b/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-MemAcc.ll
new file mode 100644
index 00000000000..ee45dedd2cd
--- /dev/null
+++ b/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-MemAcc.ll
@@ -0,0 +1,64 @@
+; RUN: opt %loadPolly -polly-import-jscop-dir=%S -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
+;
+; CHECK: The number of memory accesses in the JSop file and the number of memory accesses differ for index 0.
+;
+; Verify that the JSONImporter checks if there is the correct number of memory accesses.
+;
+; void ia4(int *A, long n) {
+; for (long i = 0; i < 2 * n; i++)
+; S0: A[0] += i;
+; for (long i = 0; i < 2 * n; i++)
+; S1: A[i + 1] = 1;
+; }
+;
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
+
+define void @ia4(i32* %A, i32 %n) {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
+ %mul = shl nsw i32 %n, 1
+ %cmp = icmp slt i32 %i.0, %mul
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ br label %S0
+
+S0: ; preds = %for.body
+ %tmp = load i32, i32* %A, align 4
+ %add = add nsw i32 %tmp, %i.0
+ store i32 %add, i32* %A, align 4
+ br label %for.inc
+
+for.inc: ; preds = %S0
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ br label %for.cond2
+
+for.cond2: ; preds = %for.inc8, %for.end
+ %i1.0 = phi i32 [ 0, %for.end ], [ %inc9, %for.inc8 ]
+ %mul3 = shl nsw i32 %n, 1
+ %cmp4 = icmp slt i32 %i1.0, %mul3
+ br i1 %cmp4, label %for.body5, label %for.end10
+
+for.body5: ; preds = %for.cond2
+ br label %S1
+
+S1: ; preds = %for.body5
+ %add6 = add nsw i32 %i1.0, 1
+ %arrayidx7 = getelementptr inbounds i32, i32* %A, i32 %add6
+ store i32 1, i32* %arrayidx7, align 4
+ br label %for.inc8
+
+for.inc8: ; preds = %S1
+ %inc9 = add nsw i32 %i1.0, 1
+ br label %for.cond2
+
+for.end10: ; preds = %for.cond2
+ ret void
+}
+
diff --git a/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-statements.ll b/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-statements.ll
new file mode 100644
index 00000000000..0c3a8756f8f
--- /dev/null
+++ b/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-statements.ll
@@ -0,0 +1,64 @@
+; RUN: opt %loadPolly -polly-import-jscop-dir=%S -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
+;
+; CHECK: The number of indices and the number of statements differ.
+;
+; Verify that the JSONImporter checks if the number of indices and the number of statements differ.
+;
+; void ia2(int *A, long n) {
+; for (long i = 0; i < 2 * n; i++)
+; S0: A[0] += i;
+; for (long i = 0; i < 2 * n; i++)
+; S1: A[i + 1] = 1;
+; }
+;
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
+
+define void @ia2(i32* %A, i32 %n) {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
+ %mul = shl nsw i32 %n, 1
+ %cmp = icmp slt i32 %i.0, %mul
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ br label %S0
+
+S0: ; preds = %for.body
+ %tmp = load i32, i32* %A, align 4
+ %add = add nsw i32 %tmp, %i.0
+ store i32 %add, i32* %A, align 4
+ br label %for.inc
+
+for.inc: ; preds = %S0
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ br label %for.cond2
+
+for.cond2: ; preds = %for.inc8, %for.end
+ %i1.0 = phi i32 [ 0, %for.end ], [ %inc9, %for.inc8 ]
+ %mul3 = shl nsw i32 %n, 1
+ %cmp4 = icmp slt i32 %i1.0, %mul3
+ br i1 %cmp4, label %for.body5, label %for.end10
+
+for.body5: ; preds = %for.cond2
+ br label %S1
+
+S1: ; preds = %for.body5
+ %add6 = add nsw i32 %i1.0, 1
+ %arrayidx7 = getelementptr inbounds i32, i32* %A, i32 %add6
+ store i32 1, i32* %arrayidx7, align 4
+ br label %for.inc8
+
+for.inc8: ; preds = %S1
+ %inc9 = add nsw i32 %i1.0, 1
+ br label %for.cond2
+
+for.end10: ; preds = %for.cond2
+ ret void
+}
+
diff --git a/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Relation-mispelled.ll b/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Relation-mispelled.ll
new file mode 100644
index 00000000000..b0ba5cef618
--- /dev/null
+++ b/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Relation-mispelled.ll
@@ -0,0 +1,64 @@
+; RUN: opt %loadPolly -polly-import-jscop-dir=%S -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
+;
+; CHECK: Memory access number 0 has no key name 'relation' for statement number 1.
+;
+; Verify that the JSONImporter checks if there is a key name 'relation' for each MemAcc.
+;
+; void ia5(int *A, long n) {
+; for (long i = 0; i < 2 * n; i++)
+; S0: A[0] += i;
+; for (long i = 0; i < 2 * n; i++)
+; S1: A[i + 1] = 1;
+; }
+;
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
+
+define void @ia5(i32* %A, i32 %n) {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
+ %mul = shl nsw i32 %n, 1
+ %cmp = icmp slt i32 %i.0, %mul
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ br label %S0
+
+S0: ; preds = %for.body
+ %tmp = load i32, i32* %A, align 4
+ %add = add nsw i32 %tmp, %i.0
+ store i32 %add, i32* %A, align 4
+ br label %for.inc
+
+for.inc: ; preds = %S0
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ br label %for.cond2
+
+for.cond2: ; preds = %for.inc8, %for.end
+ %i1.0 = phi i32 [ 0, %for.end ], [ %inc9, %for.inc8 ]
+ %mul3 = shl nsw i32 %n, 1
+ %cmp4 = icmp slt i32 %i1.0, %mul3
+ br i1 %cmp4, label %for.body5, label %for.end10
+
+for.body5: ; preds = %for.cond2
+ br label %S1
+
+S1: ; preds = %for.body5
+ %add6 = add nsw i32 %i1.0, 1
+ %arrayidx7 = getelementptr inbounds i32, i32* %A, i32 %add6
+ store i32 1, i32* %arrayidx7, align 4
+ br label %for.inc8
+
+for.inc8: ; preds = %S1
+ %inc9 = add nsw i32 %i1.0, 1
+ br label %for.cond2
+
+for.end10: ; preds = %for.cond2
+ ret void
+}
+
diff --git a/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Statements-mispelled.ll b/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Statements-mispelled.ll
new file mode 100644
index 00000000000..3a6f9d331b2
--- /dev/null
+++ b/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Statements-mispelled.ll
@@ -0,0 +1,64 @@
+; RUN: opt %loadPolly -polly-import-jscop-dir=%S -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
+;
+; CHECK: JScop file has no key name 'statements'.
+;
+; Verify that the JSONImporter checks if there is a key name 'statements'.
+;
+; void ia(int *A, long n) {
+; for (long i = 0; i < 2 * n; i++)
+; S0: A[0] += i;
+; for (long i = 0; i < 2 * n; i++)
+; S1: A[i + 1] = 1;
+; }
+;
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
+
+define void @ia(i32* %A, i32 %n) {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
+ %mul = shl nsw i32 %n, 1
+ %cmp = icmp slt i32 %i.0, %mul
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ br label %S0
+
+S0: ; preds = %for.body
+ %tmp = load i32, i32* %A, align 4
+ %add = add nsw i32 %tmp, %i.0
+ store i32 %add, i32* %A, align 4
+ br label %for.inc
+
+for.inc: ; preds = %S0
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ br label %for.cond2
+
+for.cond2: ; preds = %for.inc8, %for.end
+ %i1.0 = phi i32 [ 0, %for.end ], [ %inc9, %for.inc8 ]
+ %mul3 = shl nsw i32 %n, 1
+ %cmp4 = icmp slt i32 %i1.0, %mul3
+ br i1 %cmp4, label %for.body5, label %for.end10
+
+for.body5: ; preds = %for.cond2
+ br label %S1
+
+S1: ; preds = %for.body5
+ %add6 = add nsw i32 %i1.0, 1
+ %arrayidx7 = getelementptr inbounds i32, i32* %A, i32 %add6
+ store i32 1, i32* %arrayidx7, align 4
+ br label %for.inc8
+
+for.inc8: ; preds = %S1
+ %inc9 = add nsw i32 %i1.0, 1
+ br label %for.cond2
+
+for.end10: ; preds = %for.cond2
+ ret void
+}
+
diff --git a/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Undeclared-ScopArrayInfo.ll b/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Undeclared-ScopArrayInfo.ll
new file mode 100644
index 00000000000..0c62023128a
--- /dev/null
+++ b/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Undeclared-ScopArrayInfo.ll
@@ -0,0 +1,64 @@
+; RUN: opt %loadPolly -polly-import-jscop-dir=%S -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
+;
+; CHECK: JScop file contains access function with undeclared ScopArrayInfo
+;
+; Verify that the JSONImporter checks if the access function have a declared ScopArrayInfo.
+;
+; void ia8(int *A, long n) {
+; for (long i = 0; i < 2 * n; i++)
+; S0: A[0] += i;
+; for (long i = 0; i < 2 * n; i++)
+; S1: A[i + 1] = 1;
+; }
+;
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
+
+define void @ia8(i32* %A, i32 %n) {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
+ %mul = shl nsw i32 %n, 1
+ %cmp = icmp slt i32 %i.0, %mul
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ br label %S0
+
+S0: ; preds = %for.body
+ %tmp = load i32, i32* %A, align 4
+ %add = add nsw i32 %tmp, %i.0
+ store i32 %add, i32* %A, align 4
+ br label %for.inc
+
+for.inc: ; preds = %S0
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ br label %for.cond2
+
+for.cond2: ; preds = %for.inc8, %for.end
+ %i1.0 = phi i32 [ 0, %for.end ], [ %inc9, %for.inc8 ]
+ %mul3 = shl nsw i32 %n, 1
+ %cmp4 = icmp slt i32 %i1.0, %mul3
+ br i1 %cmp4, label %for.body5, label %for.end10
+
+for.body5: ; preds = %for.cond2
+ br label %S1
+
+S1: ; preds = %for.body5
+ %add6 = add nsw i32 %i1.0, 1
+ %arrayidx7 = getelementptr inbounds i32, i32* %A, i32 %add6
+ store i32 1, i32* %arrayidx7, align 4
+ br label %for.inc8
+
+for.inc8: ; preds = %S1
+ %inc9 = add nsw i32 %i1.0, 1
+ br label %for.cond2
+
+for.end10: ; preds = %for.cond2
+ ret void
+}
+
diff --git a/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Wrong-number-dimensions.ll b/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Wrong-number-dimensions.ll
new file mode 100644
index 00000000000..acf117af405
--- /dev/null
+++ b/polly/test/JSONExporter/ImportAccesses/ImportAccesses-Wrong-number-dimensions.ll
@@ -0,0 +1,64 @@
+; RUN: opt %loadPolly -polly-import-jscop-dir=%S -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
+;
+; CHECK: JScop file changes the number of parameter dimensions.
+;
+; Verify that the JSONImporter checks if there is the right parameter dimensions.
+;
+; void ia7(int *A, long n) {
+; for (long i = 0; i < 2 * n; i++)
+; S0: A[0] += i;
+; for (long i = 0; i < 2 * n; i++)
+; S1: A[i + 1] = 1;
+; }
+;
+target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
+
+define void @ia7(i32* %A, i32 %n) {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
+ %mul = shl nsw i32 %n, 1
+ %cmp = icmp slt i32 %i.0, %mul
+ br i1 %cmp, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ br label %S0
+
+S0: ; preds = %for.body
+ %tmp = load i32, i32* %A, align 4
+ %add = add nsw i32 %tmp, %i.0
+ store i32 %add, i32* %A, align 4
+ br label %for.inc
+
+for.inc: ; preds = %S0
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ br label %for.cond2
+
+for.cond2: ; preds = %for.inc8, %for.end
+ %i1.0 = phi i32 [ 0, %for.end ], [ %inc9, %for.inc8 ]
+ %mul3 = shl nsw i32 %n, 1
+ %cmp4 = icmp slt i32 %i1.0, %mul3
+ br i1 %cmp4, label %for.body5, label %for.end10
+
+for.body5: ; preds = %for.cond2
+ br label %S1
+
+S1: ; preds = %for.body5
+ %add6 = add nsw i32 %i1.0, 1
+ %arrayidx7 = getelementptr inbounds i32, i32* %A, i32 %add6
+ store i32 1, i32* %arrayidx7, align 4
+ br label %for.inc8
+
+for.inc8: ; preds = %S1
+ %inc9 = add nsw i32 %i1.0, 1
+ br label %for.cond2
+
+for.end10: ; preds = %for.cond2
+ ret void
+}
+
diff --git a/polly/test/JSONExporter/ImportAccesses/ia2___%for.cond---%for.end10.jscop b/polly/test/JSONExporter/ImportAccesses/ia2___%for.cond---%for.end10.jscop
new file mode 100644
index 00000000000..1199995b4bd
--- /dev/null
+++ b/polly/test/JSONExporter/ImportAccesses/ia2___%for.cond---%for.end10.jscop
@@ -0,0 +1,21 @@
+{
+ "context" : "[n] -> { : n >= -2147483648 and n <= 2147483647 }",
+ "name" : "for.cond => for.end10",
+ "statements" : [
+ {
+ "accesses" : [
+ {
+ "kind" : "read",
+ "relation" : "[n] -> { Stmt_S0[i0] -> MemRef_A[0] }"
+ },
+ {
+ "kind" : "write",
+ "relation" : "[n] -> { Stmt_S0[i0] -> MemRef_A[0] }"
+ }
+ ],
+ "domain" : "[n] -> { Stmt_S0[i0] : i0 >= 0 and i0 <= -1 + 2n and n >= 1 }",
+ "name" : "Stmt_S0",
+ "schedule" : "[n] -> { Stmt_S0[i0] -> [0, n - i0, 0] }"
+ }
+ ]
+}
diff --git a/polly/test/JSONExporter/ImportAccesses/ia3___%for.cond---%for.end10.jscop b/polly/test/JSONExporter/ImportAccesses/ia3___%for.cond---%for.end10.jscop
new file mode 100644
index 00000000000..a592c85dd2f
--- /dev/null
+++ b/polly/test/JSONExporter/ImportAccesses/ia3___%for.cond---%for.end10.jscop
@@ -0,0 +1,26 @@
+{
+ "context" : "[n] -> { : n >= -2147483648 and n <= 2147483647 }",
+ "name" : "for.cond => for.end10",
+ "statements" : [
+ {
+ "accesses" : [
+ {
+ "kind" : "read",
+ "relation" : "[n] -> { Stmt_S0[i0] -> MemRef_A[0] }"
+ },
+ {
+ "kind" : "write",
+ "relation" : "[n] -> { Stmt_S0[i0] -> MemRef_A[0] }"
+ }
+ ],
+ "domain" : "[n] -> { Stmt_S0[i0] : i0 >= 0 and i0 <= -1 + 2n and n >= 1 }",
+ "name" : "Stmt_S0",
+ "schedule" : "[n] -> { Stmt_S0[i0] -> [0, n - i0, 0] }"
+ },
+ {
+ "domain" : "[n] -> { Stmt_S1[i0] : i0 >= 0 and i0 <= -1 + 2n and n >= 1 }",
+ "name" : "Stmt_S1",
+ "schedule" : "[n] -> { Stmt_S1[i0] -> [1, n - i0, 0] }"
+ }
+ ]
+}
diff --git a/polly/test/JSONExporter/ImportAccesses/ia4___%for.cond---%for.end10.jscop b/polly/test/JSONExporter/ImportAccesses/ia4___%for.cond---%for.end10.jscop
new file mode 100644
index 00000000000..5c38777c59f
--- /dev/null
+++ b/polly/test/JSONExporter/ImportAccesses/ia4___%for.cond---%for.end10.jscop
@@ -0,0 +1,28 @@
+{
+ "context" : "[n] -> { : n >= -2147483648 and n <= 2147483647 }",
+ "name" : "for.cond => for.end10",
+ "statements" : [
+ {
+ "accesses" : [
+ {
+ "kind" : "read",
+ "relation" : "[n] -> { Stmt_S0[i0] -> MemRef_A[0] }"
+ }
+ ],
+ "domain" : "[n] -> { Stmt_S0[i0] : i0 >= 0 and i0 <= -1 + 2n and n >= 1 }",
+ "name" : "Stmt_S0",
+ "schedule" : "[n] -> { Stmt_S0[i0] -> [0, n - i0, 0] }"
+ },
+ {
+ "accesses" : [
+ {
+ "kind" : "write",
+ "relation" : "[n] -> { Stmt_S1[i0] -> MemRef_A[1 + i0] }"
+ }
+ ],
+ "domain" : "[n] -> { Stmt_S1[i0] : i0 >= 0 and i0 <= -1 + 2n and n >= 1 }",
+ "name" : "Stmt_S1",
+ "schedule" : "[n] -> { Stmt_S1[i0] -> [1, n - i0, 0] }"
+ }
+ ]
+}
diff --git a/polly/test/JSONExporter/ImportAccesses/ia5___%for.cond---%for.end10.jscop b/polly/test/JSONExporter/ImportAccesses/ia5___%for.cond---%for.end10.jscop
new file mode 100644
index 00000000000..47ed03728b9
--- /dev/null
+++ b/polly/test/JSONExporter/ImportAccesses/ia5___%for.cond---%for.end10.jscop
@@ -0,0 +1,31 @@
+{
+ "context" : "[n] -> { : n >= -2147483648 and n <= 2147483647 }",
+ "name" : "for.cond => for.end10",
+ "statements" : [
+ {
+ "accesses" : [
+ {
+ "kind" : "read",
+ "relation" : "[n] -> { Stmt_S0[i0] -> MemRef_A[0] }"
+ },
+ {
+ "kind" : "write",
+ "relation" : "[n] -> { Stmt_S0[i0] -> MemRef_A[0] }"
+ }
+ ],
+ "domain" : "[n] -> { Stmt_S0[i0] : i0 >= 0 and i0 <= -1 + 2n and n >= 1 }",
+ "name" : "Stmt_S0",
+ "schedule" : "[n] -> { Stmt_S0[i0] -> [0, n - i0, 0] }"
+ },
+ {
+ "accesses" : [
+ {
+ "kind" : "write"
+ }
+ ],
+ "domain" : "[n] -> { Stmt_S1[i0] : i0 >= 0 and i0 <= -1 + 2n and n >= 1 }",
+ "name" : "Stmt_S1",
+ "schedule" : "[n] -> { Stmt_S1[i0] -> [1, n - i0, 0] }"
+ }
+ ]
+}
diff --git a/polly/test/JSONExporter/ImportAccesses/ia6___%for.cond---%for.end10.jscop b/polly/test/JSONExporter/ImportAccesses/ia6___%for.cond---%for.end10.jscop
new file mode 100644
index 00000000000..5cd919a000a
--- /dev/null
+++ b/polly/test/JSONExporter/ImportAccesses/ia6___%for.cond---%for.end10.jscop
@@ -0,0 +1,32 @@
+{
+ "context" : "[n] -> { : n >= -2147483648 and n <= 2147483647 }",
+ "name" : "for.cond => for.end10",
+ "statements" : [
+ {
+ "accesses" : [
+ {
+ "kind" : "read",
+ "relation" : "[n -> { Stmt_S0[i0] -> MemRef_A[0] }"
+ },
+ {
+ "kind" : "write",
+ "relation" : "[n] -> { Stmt_S0[i0] -> MemRef_A[0] }"
+ }
+ ],
+ "domain" : "[n] -> { Stmt_S0[i0] : i0 >= 0 and i0 <= -1 + 2n and n >= 1 }",
+ "name" : "Stmt_S0",
+ "schedule" : "[n] -> { Stmt_S0[i0] -> [0, n - i0, 0] }"
+ },
+ {
+ "accesses" : [
+ {
+ "kind" : "write",
+ "relation" : "[n] -> { Stmt_S1[i0] -> MemRef_A[1 + i0] }"
+ }
+ ],
+ "domain" : "[n] -> { Stmt_S1[i0] : i0 >= 0 and i0 <= -1 + 2n and n >= 1 }",
+ "name" : "Stmt_S1",
+ "schedule" : "[n] -> { Stmt_S1[i0] -> [1, n - i0, 0] }"
+ }
+ ]
+}
diff --git a/polly/test/JSONExporter/ImportAccesses/ia7___%for.cond---%for.end10.jscop b/polly/test/JSONExporter/ImportAccesses/ia7___%for.cond---%for.end10.jscop
new file mode 100644
index 00000000000..1b7826e5bc4
--- /dev/null
+++ b/polly/test/JSONExporter/ImportAccesses/ia7___%for.cond---%for.end10.jscop
@@ -0,0 +1,32 @@
+{
+ "context" : "[n] -> { : n >= -2147483648 and n <= 2147483647 }",
+ "name" : "for.cond => for.end10",
+ "statements" : [
+ {
+ "accesses" : [
+ {
+ "kind" : "read",
+ "relation" : "[n] -> { Stmt_S0[i0] -> MemRef_A[0] }"
+ },
+ {
+ "kind" : "write",
+ "relation" : "[n, m] -> { Stmt_S0[i0] -> MemRef_A[0] }"
+ }
+ ],
+ "domain" : "[n] -> { Stmt_S0[i0] : i0 >= 0 and i0 <= -1 + 2n and n >= 1 }",
+ "name" : "Stmt_S0",
+ "schedule" : "[n] -> { Stmt_S0[i0] -> [0, n - i0, 0] }"
+ },
+ {
+ "accesses" : [
+ {
+ "kind" : "write",
+ "relation" : "[n] -> { Stmt_S1[i0] -> MemRef_A[1 + i0] }"
+ }
+ ],
+ "domain" : "[n] -> { Stmt_S1[i0] : i0 >= 0 and i0 <= -1 + 2n and n >= 1 }",
+ "name" : "Stmt_S1",
+ "schedule" : "[n] -> { Stmt_S1[i0] -> [1, n - i0, 0] }"
+ }
+ ]
+}
diff --git a/polly/test/JSONExporter/ImportAccesses/ia8___%for.cond---%for.end10.jscop b/polly/test/JSONExporter/ImportAccesses/ia8___%for.cond---%for.end10.jscop
new file mode 100644
index 00000000000..0680d3c4fac
--- /dev/null
+++ b/polly/test/JSONExporter/ImportAccesses/ia8___%for.cond---%for.end10.jscop
@@ -0,0 +1,32 @@
+{
+ "context" : "[n] -> { : n >= -2147483648 and n <= 2147483647 }",
+ "name" : "for.cond => for.end10",
+ "statements" : [
+ {
+ "accesses" : [
+ {
+ "kind" : "read",
+ "relation" : "[n] -> { Stmt_S0[i0] -> Memef_A[0] }"
+ },
+ {
+ "kind" : "write",
+ "relation" : "[n] -> { Stmt_S0[i0] -> MemRef_A[0] }"
+ }
+ ],
+ "domain" : "[n] -> { Stmt_S0[i0] : i0 >= 0 and i0 <= -1 + 2n and n >= 1 }",
+ "name" : "Stmt_S0",
+ "schedule" : "[n] -> { Stmt_S0[i0] -> [0, n - i0, 0] }"
+ },
+ {
+ "accesses" : [
+ {
+ "kind" : "write",
+ "relation" : "[n] -> { Stmt_S1[i0] -> MemRef_A[1 + i0] }"
+ }
+ ],
+ "domain" : "[n] -> { Stmt_S1[i0] : i0 >= 0 and i0 <= -1 + 2n and n >= 1 }",
+ "name" : "Stmt_S1",
+ "schedule" : "[n] -> { Stmt_S1[i0] -> [1, n - i0, 0] }"
+ }
+ ]
+}
diff --git a/polly/test/JSONExporter/ImportAccesses/ia___%for.cond---%for.end10.jscop b/polly/test/JSONExporter/ImportAccesses/ia___%for.cond---%for.end10.jscop
new file mode 100644
index 00000000000..b341786edb3
--- /dev/null
+++ b/polly/test/JSONExporter/ImportAccesses/ia___%for.cond---%for.end10.jscop
@@ -0,0 +1,32 @@
+{
+ "context" : "[n] -> { : n >= -2147483648 and n <= 2147483647 }",
+ "name" : "for.cond => for.end10",
+ "sttements" : [
+ {
+ "accesses" : [
+ {
+ "kind" : "read",
+ "relation" : "[n] -> { Stmt_S0[i0] -> MemRef_A[0] }"
+ },
+ {
+ "kind" : "write",
+ "relation" : "[n] -> { Stmt_S0[i0] -> MemRef_A[0] }"
+ }
+ ],
+ "domain" : "[n] -> { Stmt_S0[i0] : i0 >= 0 and i0 <= -1 + 2n and n >= 1 }",
+ "name" : "Stmt_S0",
+ "schedule" : "[n] -> { Stmt_S0[i0] -> [0, n - i0, 0] }"
+ },
+ {
+ "accesses" : [
+ {
+ "kind" : "write",
+ "relation" : "[n] -> { Stmt_S1[i0] -> MemRef_A[1 + i0] }"
+ }
+ ],
+ "domain" : "[n] -> { Stmt_S1[i0] : i0 >= 0 and i0 <= -1 + 2n and n >= 1 }",
+ "name" : "Stmt_S1",
+ "schedule" : "[n] -> { Stmt_S1[i0] -> [1, n - i0, 0] }"
+ }
+ ]
+}
OpenPOWER on IntegriCloud