[polly] r303759 - [JSONImporter] misses checks whether the data it imports makes sense.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 08:09:36 PDT 2017


Author: meinersbur
Date: Wed May 24 10:09:35 2017
New Revision: 303759

URL: http://llvm.org/viewvc/llvm-project?rev=303759&view=rev
Log:
[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 at insa-lyon.fr>

Differential Revision: https://reviews.llvm.org/D32739

Added:
    polly/trunk/test/JSONExporter/
    polly/trunk/test/JSONExporter/ImportAccesses/
    polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Bad-relation.ll
    polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-No-accesses-key.ll
    polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-MemAcc.ll
    polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-statements.ll
    polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Relation-mispelled.ll
    polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Statements-mispelled.ll
    polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Undeclared-ScopArrayInfo.ll
    polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Wrong-number-dimensions.ll
    polly/trunk/test/JSONExporter/ImportAccesses/ia2___%for.cond---%for.end10.jscop
    polly/trunk/test/JSONExporter/ImportAccesses/ia3___%for.cond---%for.end10.jscop
    polly/trunk/test/JSONExporter/ImportAccesses/ia4___%for.cond---%for.end10.jscop
    polly/trunk/test/JSONExporter/ImportAccesses/ia5___%for.cond---%for.end10.jscop
    polly/trunk/test/JSONExporter/ImportAccesses/ia6___%for.cond---%for.end10.jscop
    polly/trunk/test/JSONExporter/ImportAccesses/ia7___%for.cond---%for.end10.jscop
    polly/trunk/test/JSONExporter/ImportAccesses/ia8___%for.cond---%for.end10.jscop
    polly/trunk/test/JSONExporter/ImportAccesses/ia___%for.cond---%for.end10.jscop
    polly/trunk/test/JSONExporter/ImportArrays/
    polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-Mispelled-type.ll
    polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-No-name.ll
    polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-No-sizes-key.ll
    polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-No-type-key.ll
    polly/trunk/test/JSONExporter/ImportArrays/ia2___%bb9---%bb26.jscop.transformed
    polly/trunk/test/JSONExporter/ImportArrays/ia3___%bb9---%bb26.jscop.transformed
    polly/trunk/test/JSONExporter/ImportArrays/ia4___%bb9---%bb26.jscop.transformed
    polly/trunk/test/JSONExporter/ImportArrays/ia___%bb9---%bb26.jscop.transformed
    polly/trunk/test/JSONExporter/ImportContext/
    polly/trunk/test/JSONExporter/ImportContext/ImportContext-Context-mispelled.ll
    polly/trunk/test/JSONExporter/ImportContext/ImportContext-Not-parameter-set.ll
    polly/trunk/test/JSONExporter/ImportContext/ImportContext-Unvalid-Context.ll
    polly/trunk/test/JSONExporter/ImportContext/ImportContext-Wrong-dimension.ll
    polly/trunk/test/JSONExporter/ImportContext/ic2___%for.cond---%for.end10.jscop
    polly/trunk/test/JSONExporter/ImportContext/ic3___%for.cond---%for.end10.jscop
    polly/trunk/test/JSONExporter/ImportContext/ic4___%for.cond---%for.end10.jscop
    polly/trunk/test/JSONExporter/ImportContext/ic___%for.cond---%for.end10.jscop
    polly/trunk/test/JSONExporter/ImportSchedule/
    polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-No-schedule-key.ll
    polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-Schedule-not-valid.ll
    polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-Statements-mispelled.ll
    polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-Wrong-number-statements.ll
    polly/trunk/test/JSONExporter/ImportSchedule/is2___%for.cond---%for.end10.jscop
    polly/trunk/test/JSONExporter/ImportSchedule/is3___%for.cond---%for.end10.jscop
    polly/trunk/test/JSONExporter/ImportSchedule/is4___%for.cond---%for.end10.jscop
    polly/trunk/test/JSONExporter/ImportSchedule/is___%for.cond---%for.end10.jscop
Modified:
    polly/trunk/lib/Exchange/JSONExporter.cpp

Modified: polly/trunk/lib/Exchange/JSONExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/JSONExporter.cpp?rev=303759&r1=303758&r2=303759&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/JSONExporter.cpp (original)
+++ polly/trunk/lib/Exchange/JSONExporter.cpp Wed May 24 10:09:35 2017
@@ -274,10 +274,47 @@ typedef Dependences::StatementToIslMapTy
 
 bool JSONImporter::importContext(Scop &S, Json::Value &JScop) {
   isl_set *OldContext = S.getContext();
+
+  // Check if key 'context' is present.
+  if (!JScop.isMember("context")) {
+    errs() << "JScop file has no key named 'context'.\n";
+    isl_set_free(OldContext);
+    return false;
+  }
+
   isl_set *NewContext =
       isl_set_read_from_str(S.getIslCtx(), JScop["context"].asCString());
 
-  for (unsigned i = 0; i < isl_set_dim(OldContext, isl_dim_param); i++) {
+  // Check whether the context was parsed successfully.
+  if (!NewContext) {
+    errs() << "The context was not parsed successfully by ISL.\n";
+    isl_set_free(NewContext);
+    isl_set_free(OldContext);
+    return false;
+  }
+
+  // Check if the isl_set is a parameter set.
+  if (!isl_set_is_params(NewContext)) {
+    errs() << "The isl_set is not a parameter set.\n";
+    isl_set_free(NewContext);
+    isl_set_free(OldContext);
+    return false;
+  }
+
+  unsigned OldContextDim = isl_set_dim(OldContext, isl_dim_param);
+  unsigned NewContextDim = isl_set_dim(NewContext, isl_dim_param);
+
+  // Check if the imported context has the right number of parameters.
+  if (OldContextDim != NewContextDim) {
+    errs() << "Imported context has the wrong number of parameters : "
+           << "Found " << NewContextDim << " Expected " << OldContextDim
+           << "\n";
+    isl_set_free(NewContext);
+    isl_set_free(OldContext);
+    return false;
+  }
+
+  for (unsigned i = 0; i < OldContextDim; i++) {
     isl_id *Id = isl_set_get_dim_id(OldContext, isl_dim_param, i);
     NewContext = isl_set_set_dim_id(NewContext, isl_dim_param, i, Id);
   }
@@ -291,12 +328,45 @@ bool JSONImporter::importSchedule(Scop &
                                   const Dependences &D) {
   StatementToIslMapTy NewSchedule;
 
+  // Check if key 'statements' is present.
+  if (!JScop.isMember("statements")) {
+    errs() << "JScop file has no key name 'statements'.\n";
+    return false;
+  }
+
+  Json::Value statements = JScop["statements"];
+
+  // Check whether the number of indices equals the number of statements
+  if (statements.size() != S.getSize()) {
+    errs() << "The number of indices and the number of statements differ.\n";
+    return false;
+  }
+
   int Index = 0;
   for (ScopStmt &Stmt : S) {
-    Json::Value Schedule = JScop["statements"][Index]["schedule"];
+    // Check if key 'schedule' is present.
+    if (!statements[Index].isMember("schedule")) {
+      errs() << "Statement " << Index << " has no 'schedule' key.\n";
+      for (auto Element : NewSchedule) {
+        isl_map_free(Element.second);
+      }
+      return false;
+    }
+    Json::Value Schedule = statements[Index]["schedule"];
     assert(!Schedule.asString().empty() &&
            "Schedules that contain extension nodes require special handling.");
     isl_map *Map = isl_map_read_from_str(S.getIslCtx(), Schedule.asCString());
+
+    // Check whether the schedule was parsed successfully
+    if (!Map) {
+      errs() << "The schedule was not parsed successfully (index = " << Index
+             << ").\n";
+      for (auto Element : NewSchedule) {
+        isl_map_free(Element.second);
+      }
+      return false;
+    }
+
     isl_space *Space = Stmt.getDomainSpace();
 
     // Copy the old tuple id. This is necessary to retain the user pointer,
@@ -312,6 +382,7 @@ bool JSONImporter::importSchedule(Scop &
     Index++;
   }
 
+  // Check whether the new schedule is valid or not.
   if (!D.isValidSchedule(S, &NewSchedule)) {
     errs() << "JScop file contains a schedule that changes the "
            << "dependences. Use -disable-polly-legality to continue anyways\n";
@@ -336,18 +407,64 @@ bool JSONImporter::importSchedule(Scop &
 bool JSONImporter::importAccesses(Scop &S, Json::Value &JScop,
                                   const DataLayout &DL) {
   int StatementIdx = 0;
+
+  // Check if key 'statements' is present.
+  if (!JScop.isMember("statements")) {
+    errs() << "JScop file has no key name 'statements'.\n";
+    return false;
+  }
+  Json::Value statements = JScop["statements"];
+
+  // Check whether the number of indices equals the number of statements
+  if (statements.size() != S.getSize()) {
+    errs() << "The number of indices and the number of statements differ.\n";
+    return false;
+  }
+
   for (ScopStmt &Stmt : S) {
     int MemoryAccessIdx = 0;
+
+    // Check if key 'accesses' is present.
+    if (!statements[StatementIdx].isMember("accesses")) {
+      errs()
+          << "Statement from JScop file has no key name 'accesses' for index "
+          << StatementIdx << ".\n";
+      return false;
+    }
+
+    // Check whether the number of indices equals the number of memory accesses
+    if (Stmt.size() != statements[StatementIdx]["accesses"].size()) {
+      errs() << "The number of memory accesses in the JSop file and the number "
+                "of memory accesses differ for index "
+             << StatementIdx << ".\n";
+      return false;
+    }
+
     for (MemoryAccess *MA : Stmt) {
-      Json::Value Accesses = JScop["statements"][StatementIdx]["accesses"]
-                                  [MemoryAccessIdx]["relation"];
+      // Check if key 'relation' is present.
+      Json::Value JsonMemoryAccess =
+          statements[StatementIdx]["accesses"][MemoryAccessIdx];
+      if (!JsonMemoryAccess.isMember("relation")) {
+        errs() << "Memory access number " << MemoryAccessIdx
+               << " has no key name 'relation' for statement number "
+               << StatementIdx << ".\n";
+        return false;
+      }
+      Json::Value Accesses = JsonMemoryAccess["relation"];
       isl_map *NewAccessMap =
           isl_map_read_from_str(S.getIslCtx(), Accesses.asCString());
+
+      // Check whether the access was parsed successfully
+      if (!NewAccessMap) {
+        errs() << "The access was not parsed successfully by ISL.\n";
+        return false;
+      }
       isl_map *CurrentAccessMap = MA->getAccessRelation();
 
+      // Check if the number of parameter change
       if (isl_map_dim(NewAccessMap, isl_dim_param) !=
           isl_map_dim(CurrentAccessMap, isl_dim_param)) {
-        errs() << "JScop file changes the number of parameter dimensions\n";
+        errs() << "JScop file changes the number of parameter dimensions.\n";
         isl_map_free(CurrentAccessMap);
         isl_map_free(NewAccessMap);
         return false;
@@ -405,6 +522,7 @@ bool JSONImporter::importAccesses(Scop &
           isl_set_free(NewAccessSet);
           isl_set_free(CurrentAccessSet);
 
+          // Check if the JScop file changes the accessed memory.
           if (!IsSubset) {
             errs() << "JScop file changes the accessed memory\n";
             isl_map_free(CurrentAccessMap);
@@ -482,6 +600,24 @@ bool areArraysEqual(ScopArrayInfo *SAI,
   std::string Buffer;
   llvm::raw_string_ostream RawStringOstream(Buffer);
 
+  // Check if key 'type' is present.
+  if (!Array.isMember("type")) {
+    errs() << "Array has no key 'type'.\n";
+    return false;
+  }
+
+  // Check if key 'sizes' is present.
+  if (!Array.isMember("sizes")) {
+    errs() << "Array has no key 'sizes'.\n";
+    return false;
+  }
+
+  // Check if key 'name' is present.
+  if (!Array.isMember("name")) {
+    errs() << "Array has no key 'name'.\n";
+    return false;
+  }
+
   if (SAI->getName() != Array["name"].asCString())
     return false;
 
@@ -495,9 +631,12 @@ bool areArraysEqual(ScopArrayInfo *SAI,
     Buffer.clear();
   }
 
+  // Check if key 'type' differs from the current one or is not valid.
   SAI->getElementType()->print(RawStringOstream);
-  if (RawStringOstream.str() != Array["type"].asCString())
+  if (RawStringOstream.str() != Array["type"].asCString()) {
+    errs() << "Array has not a valid type.\n";
     return false;
+  }
 
   return true;
 }
@@ -536,7 +675,6 @@ Type *parseTextType(const std::string &T
 
 bool JSONImporter::importArrays(Scop &S, Json::Value &JScop) {
   Json::Value Arrays = JScop["arrays"];
-
   if (Arrays.size() == 0)
     return true;
 

Added: polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Bad-relation.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Bad-relation.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Bad-relation.ll (added)
+++ polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Bad-relation.ll Wed May 24 10:09:35 2017
@@ -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
+}
+

Added: polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-No-accesses-key.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-No-accesses-key.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-No-accesses-key.ll (added)
+++ polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-No-accesses-key.ll Wed May 24 10:09:35 2017
@@ -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
+}
+

Added: polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-MemAcc.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-MemAcc.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-MemAcc.ll (added)
+++ polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-MemAcc.ll Wed May 24 10:09:35 2017
@@ -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
+}
+

Added: polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-statements.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-statements.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-statements.ll (added)
+++ polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-statements.ll Wed May 24 10:09:35 2017
@@ -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
+}
+

Added: polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Relation-mispelled.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Relation-mispelled.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Relation-mispelled.ll (added)
+++ polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Relation-mispelled.ll Wed May 24 10:09:35 2017
@@ -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
+}
+

Added: polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Statements-mispelled.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Statements-mispelled.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Statements-mispelled.ll (added)
+++ polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Statements-mispelled.ll Wed May 24 10:09:35 2017
@@ -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
+}
+

Added: polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Undeclared-ScopArrayInfo.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Undeclared-ScopArrayInfo.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Undeclared-ScopArrayInfo.ll (added)
+++ polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Undeclared-ScopArrayInfo.ll Wed May 24 10:09:35 2017
@@ -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
+}
+

Added: polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Wrong-number-dimensions.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Wrong-number-dimensions.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Wrong-number-dimensions.ll (added)
+++ polly/trunk/test/JSONExporter/ImportAccesses/ImportAccesses-Wrong-number-dimensions.ll Wed May 24 10:09:35 2017
@@ -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
+}
+

Added: polly/trunk/test/JSONExporter/ImportAccesses/ia2___%for.cond---%for.end10.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportAccesses/ia2___%25for.cond---%25for.end10.jscop?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportAccesses/ia2___%for.cond---%for.end10.jscop (added)
+++ polly/trunk/test/JSONExporter/ImportAccesses/ia2___%for.cond---%for.end10.jscop Wed May 24 10:09:35 2017
@@ -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] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportAccesses/ia3___%for.cond---%for.end10.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportAccesses/ia3___%25for.cond---%25for.end10.jscop?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportAccesses/ia3___%for.cond---%for.end10.jscop (added)
+++ polly/trunk/test/JSONExporter/ImportAccesses/ia3___%for.cond---%for.end10.jscop Wed May 24 10:09:35 2017
@@ -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] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportAccesses/ia4___%for.cond---%for.end10.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportAccesses/ia4___%25for.cond---%25for.end10.jscop?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportAccesses/ia4___%for.cond---%for.end10.jscop (added)
+++ polly/trunk/test/JSONExporter/ImportAccesses/ia4___%for.cond---%for.end10.jscop Wed May 24 10:09:35 2017
@@ -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] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportAccesses/ia5___%for.cond---%for.end10.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportAccesses/ia5___%25for.cond---%25for.end10.jscop?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportAccesses/ia5___%for.cond---%for.end10.jscop (added)
+++ polly/trunk/test/JSONExporter/ImportAccesses/ia5___%for.cond---%for.end10.jscop Wed May 24 10:09:35 2017
@@ -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] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportAccesses/ia6___%for.cond---%for.end10.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportAccesses/ia6___%25for.cond---%25for.end10.jscop?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportAccesses/ia6___%for.cond---%for.end10.jscop (added)
+++ polly/trunk/test/JSONExporter/ImportAccesses/ia6___%for.cond---%for.end10.jscop Wed May 24 10:09:35 2017
@@ -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] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportAccesses/ia7___%for.cond---%for.end10.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportAccesses/ia7___%25for.cond---%25for.end10.jscop?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportAccesses/ia7___%for.cond---%for.end10.jscop (added)
+++ polly/trunk/test/JSONExporter/ImportAccesses/ia7___%for.cond---%for.end10.jscop Wed May 24 10:09:35 2017
@@ -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] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportAccesses/ia8___%for.cond---%for.end10.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportAccesses/ia8___%25for.cond---%25for.end10.jscop?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportAccesses/ia8___%for.cond---%for.end10.jscop (added)
+++ polly/trunk/test/JSONExporter/ImportAccesses/ia8___%for.cond---%for.end10.jscop Wed May 24 10:09:35 2017
@@ -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] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportAccesses/ia___%for.cond---%for.end10.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportAccesses/ia___%25for.cond---%25for.end10.jscop?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportAccesses/ia___%for.cond---%for.end10.jscop (added)
+++ polly/trunk/test/JSONExporter/ImportAccesses/ia___%for.cond---%for.end10.jscop Wed May 24 10:09:35 2017
@@ -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] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-Mispelled-type.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-Mispelled-type.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-Mispelled-type.ll (added)
+++ polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-Mispelled-type.ll Wed May 24 10:09:35 2017
@@ -0,0 +1,58 @@
+; RUN: opt %loadPolly -polly-scops -analyze -polly-import-jscop-dir=%S -polly-import-jscop -polly-import-jscop-postfix=transformed < %s 2>&1 | FileCheck %s
+;
+; CHECK: Array has not a valid type.
+;
+; Verify if the JSONImporter checks if the parsed type is valid.
+;
+;  for (i = 0; i < _PB_NI; i++)
+;    for (j = 0; j < _PB_NJ; j++)
+;      for (k = 0; k < _PB_NK; ++k)
+;        B[i][j] = beta * A[i][k];
+;
+;
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-unknown"
+
+; Function Attrs: nounwind uwtable
+define internal void @ia4(i32 %arg, i32 %arg1, i32 %arg2, double %arg3, double %beta, [1056 x double]* %A, [1024 x double]* %B, [1056 x double]* %arg7) #0 {
+bb:
+  br label %bb8
+
+bb8:                                              ; preds = %bb
+  br label %bb9
+
+bb9:                                              ; preds = %bb23, %bb8
+  %tmp = phi i64 [ 0, %bb8 ], [ %tmp24, %bb23 ]
+  br label %bb10
+
+bb10:                                             ; preds = %bb20, %bb9
+  %tmp11 = phi i64 [ 0, %bb9 ], [ %tmp21, %bb20 ]
+  br label %bb12
+
+bb12:                                             ; preds = %bb12, %bb10
+  %tmp13 = phi i64 [ 0, %bb10 ], [ %tmp18, %bb12 ]
+  %tmp14 = getelementptr inbounds [1024 x double], [1024 x double]* %B, i64 %tmp, i64 %tmp13
+  %tmp15 = load double, double* %tmp14, align 8
+  %tmp16 = fmul double %tmp15, %beta
+  %tmp17 = getelementptr inbounds [1056 x double], [1056 x double]* %A, i64 %tmp, i64 %tmp11
+  store double %tmp16, double* %tmp17, align 8
+  %tmp18 = add nuw nsw i64 %tmp13, 1
+  %tmp19 = icmp ne i64 %tmp18, 1024
+  br i1 %tmp19, label %bb12, label %bb20
+
+bb20:                                             ; preds = %bb12
+  %tmp21 = add nuw nsw i64 %tmp11, 1
+  %tmp22 = icmp ne i64 %tmp21, 1056
+  br i1 %tmp22, label %bb10, label %bb23
+
+bb23:                                             ; preds = %bb20
+  %tmp24 = add nuw nsw i64 %tmp, 1
+  %tmp25 = icmp ne i64 %tmp24, 1056
+  br i1 %tmp25, label %bb9, label %bb26
+
+bb26:                                             ; preds = %bb23
+  ret void
+}
+
+attributes #0 = { nounwind uwtable "target-cpu"="x86-64" "target-features"="+aes,+avx,+cmov,+cx16,+fxsr,+mmx,+pclmul,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt" }

Added: polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-No-name.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-No-name.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-No-name.ll (added)
+++ polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-No-name.ll Wed May 24 10:09:35 2017
@@ -0,0 +1,58 @@
+; RUN: opt %loadPolly -polly-scops -analyze -polly-import-jscop-dir=%S -polly-import-jscop -polly-import-jscop-postfix=transformed < %s 2>&1 | FileCheck %s
+;
+; CHECK: Array has no key 'name'.
+;
+; Verify if the JSONImporter checks if the arrays have a key name 'name'.
+;
+;  for (i = 0; i < _PB_NI; i++)
+;    for (j = 0; j < _PB_NJ; j++)
+;      for (k = 0; k < _PB_NK; ++k)
+;        B[i][j] = beta * A[i][k];
+;
+;
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-unknown"
+
+; Function Attrs: nounwind uwtable
+define internal void @ia3(i32 %arg, i32 %arg1, i32 %arg2, double %arg3, double %beta, [1056 x double]* %A, [1024 x double]* %B, [1056 x double]* %arg7) #0 {
+bb:
+  br label %bb8
+
+bb8:                                              ; preds = %bb
+  br label %bb9
+
+bb9:                                              ; preds = %bb23, %bb8
+  %tmp = phi i64 [ 0, %bb8 ], [ %tmp24, %bb23 ]
+  br label %bb10
+
+bb10:                                             ; preds = %bb20, %bb9
+  %tmp11 = phi i64 [ 0, %bb9 ], [ %tmp21, %bb20 ]
+  br label %bb12
+
+bb12:                                             ; preds = %bb12, %bb10
+  %tmp13 = phi i64 [ 0, %bb10 ], [ %tmp18, %bb12 ]
+  %tmp14 = getelementptr inbounds [1024 x double], [1024 x double]* %B, i64 %tmp, i64 %tmp13
+  %tmp15 = load double, double* %tmp14, align 8
+  %tmp16 = fmul double %tmp15, %beta
+  %tmp17 = getelementptr inbounds [1056 x double], [1056 x double]* %A, i64 %tmp, i64 %tmp11
+  store double %tmp16, double* %tmp17, align 8
+  %tmp18 = add nuw nsw i64 %tmp13, 1
+  %tmp19 = icmp ne i64 %tmp18, 1024
+  br i1 %tmp19, label %bb12, label %bb20
+
+bb20:                                             ; preds = %bb12
+  %tmp21 = add nuw nsw i64 %tmp11, 1
+  %tmp22 = icmp ne i64 %tmp21, 1056
+  br i1 %tmp22, label %bb10, label %bb23
+
+bb23:                                             ; preds = %bb20
+  %tmp24 = add nuw nsw i64 %tmp, 1
+  %tmp25 = icmp ne i64 %tmp24, 1056
+  br i1 %tmp25, label %bb9, label %bb26
+
+bb26:                                             ; preds = %bb23
+  ret void
+}
+
+attributes #0 = { nounwind uwtable "target-cpu"="x86-64" "target-features"="+aes,+avx,+cmov,+cx16,+fxsr,+mmx,+pclmul,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt" }

Added: polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-No-sizes-key.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-No-sizes-key.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-No-sizes-key.ll (added)
+++ polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-No-sizes-key.ll Wed May 24 10:09:35 2017
@@ -0,0 +1,58 @@
+; RUN: opt %loadPolly -polly-scops -analyze -polly-import-jscop-dir=%S -polly-import-jscop -polly-import-jscop-postfix=transformed < %s 2>&1 | FileCheck %s
+;
+; CHECK: Array has no key 'sizes'.
+;
+; Verify if the JSONImporter checks if the arrays have a key name 'sizes'.
+;
+;  for (i = 0; i < _PB_NI; i++)
+;    for (j = 0; j < _PB_NJ; j++)
+;      for (k = 0; k < _PB_NK; ++k)
+;        B[i][j] = beta * A[i][k];
+;
+;
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-unknown"
+
+; Function Attrs: nounwind uwtable
+define internal void @ia2(i32 %arg, i32 %arg1, i32 %arg2, double %arg3, double %beta, [1056 x double]* %A, [1024 x double]* %B, [1056 x double]* %arg7) #0 {
+bb:
+  br label %bb8
+
+bb8:                                              ; preds = %bb
+  br label %bb9
+
+bb9:                                              ; preds = %bb23, %bb8
+  %tmp = phi i64 [ 0, %bb8 ], [ %tmp24, %bb23 ]
+  br label %bb10
+
+bb10:                                             ; preds = %bb20, %bb9
+  %tmp11 = phi i64 [ 0, %bb9 ], [ %tmp21, %bb20 ]
+  br label %bb12
+
+bb12:                                             ; preds = %bb12, %bb10
+  %tmp13 = phi i64 [ 0, %bb10 ], [ %tmp18, %bb12 ]
+  %tmp14 = getelementptr inbounds [1024 x double], [1024 x double]* %B, i64 %tmp, i64 %tmp13
+  %tmp15 = load double, double* %tmp14, align 8
+  %tmp16 = fmul double %tmp15, %beta
+  %tmp17 = getelementptr inbounds [1056 x double], [1056 x double]* %A, i64 %tmp, i64 %tmp11
+  store double %tmp16, double* %tmp17, align 8
+  %tmp18 = add nuw nsw i64 %tmp13, 1
+  %tmp19 = icmp ne i64 %tmp18, 1024
+  br i1 %tmp19, label %bb12, label %bb20
+
+bb20:                                             ; preds = %bb12
+  %tmp21 = add nuw nsw i64 %tmp11, 1
+  %tmp22 = icmp ne i64 %tmp21, 1056
+  br i1 %tmp22, label %bb10, label %bb23
+
+bb23:                                             ; preds = %bb20
+  %tmp24 = add nuw nsw i64 %tmp, 1
+  %tmp25 = icmp ne i64 %tmp24, 1056
+  br i1 %tmp25, label %bb9, label %bb26
+
+bb26:                                             ; preds = %bb23
+  ret void
+}
+
+attributes #0 = { nounwind uwtable "target-cpu"="x86-64" "target-features"="+aes,+avx,+cmov,+cx16,+fxsr,+mmx,+pclmul,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt" }

Added: polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-No-type-key.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-No-type-key.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-No-type-key.ll (added)
+++ polly/trunk/test/JSONExporter/ImportArrays/ImportArrays-No-type-key.ll Wed May 24 10:09:35 2017
@@ -0,0 +1,58 @@
+; RUN: opt %loadPolly -polly-scops -analyze -polly-import-jscop-dir=%S -polly-import-jscop -polly-import-jscop-postfix=transformed < %s 2>&1 | FileCheck %s
+;
+; CHECK: Array has no key 'type'.
+;
+; Verify if the JSONImporter checks if the arrays have a key name 'type'.
+;
+;  for (i = 0; i < _PB_NI; i++)
+;    for (j = 0; j < _PB_NJ; j++)
+;      for (k = 0; k < _PB_NK; ++k)
+;        B[i][j] = beta * A[i][k];
+;
+;
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-unknown"
+
+; Function Attrs: nounwind uwtable
+define internal void @ia(i32 %arg, i32 %arg1, i32 %arg2, double %arg3, double %beta, [1056 x double]* %A, [1024 x double]* %B, [1056 x double]* %arg7) #0 {
+bb:
+  br label %bb8
+
+bb8:                                              ; preds = %bb
+  br label %bb9
+
+bb9:                                              ; preds = %bb23, %bb8
+  %tmp = phi i64 [ 0, %bb8 ], [ %tmp24, %bb23 ]
+  br label %bb10
+
+bb10:                                             ; preds = %bb20, %bb9
+  %tmp11 = phi i64 [ 0, %bb9 ], [ %tmp21, %bb20 ]
+  br label %bb12
+
+bb12:                                             ; preds = %bb12, %bb10
+  %tmp13 = phi i64 [ 0, %bb10 ], [ %tmp18, %bb12 ]
+  %tmp14 = getelementptr inbounds [1024 x double], [1024 x double]* %B, i64 %tmp, i64 %tmp13
+  %tmp15 = load double, double* %tmp14, align 8
+  %tmp16 = fmul double %tmp15, %beta
+  %tmp17 = getelementptr inbounds [1056 x double], [1056 x double]* %A, i64 %tmp, i64 %tmp11
+  store double %tmp16, double* %tmp17, align 8
+  %tmp18 = add nuw nsw i64 %tmp13, 1
+  %tmp19 = icmp ne i64 %tmp18, 1024
+  br i1 %tmp19, label %bb12, label %bb20
+
+bb20:                                             ; preds = %bb12
+  %tmp21 = add nuw nsw i64 %tmp11, 1
+  %tmp22 = icmp ne i64 %tmp21, 1056
+  br i1 %tmp22, label %bb10, label %bb23
+
+bb23:                                             ; preds = %bb20
+  %tmp24 = add nuw nsw i64 %tmp, 1
+  %tmp25 = icmp ne i64 %tmp24, 1056
+  br i1 %tmp25, label %bb9, label %bb26
+
+bb26:                                             ; preds = %bb23
+  ret void
+}
+
+attributes #0 = { nounwind uwtable "target-cpu"="x86-64" "target-features"="+aes,+avx,+cmov,+cx16,+fxsr,+mmx,+pclmul,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt" }

Added: polly/trunk/test/JSONExporter/ImportArrays/ia2___%bb9---%bb26.jscop.transformed
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportArrays/ia2___%25bb9---%25bb26.jscop.transformed?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportArrays/ia2___%bb9---%bb26.jscop.transformed (added)
+++ polly/trunk/test/JSONExporter/ImportArrays/ia2___%bb9---%bb26.jscop.transformed Wed May 24 10:09:35 2017
@@ -0,0 +1,51 @@
+{
+   "arrays" : [
+       {
+         "name" : "MemRef_B",
+	 "type" : "double"
+      },
+      {
+         "name" : "MemRef_A",
+         "sizes" : [ "*", "1056" ],
+         "type" : "double"
+      },
+      {
+         "name" : "D",
+         "sizes" : [ "270336" ],
+         "type" : "double"
+      },
+      {
+         "name" : "E",
+         "sizes" : [ "270336", "200000" ],
+         "type" : "double"
+      },
+      {
+         "name" : "F",
+         "sizes" : [ "270336" ],
+         "type" : "i64"
+      }
+   ],
+   "context" : "{  :  }",
+   "name" : "%bb9---%bb26",
+   "statements" : [
+      {
+         "accesses" : [
+            {
+               "kind" : "read",
+               "relation" : "{ Stmt_bb12[i0, i1, i2] -> E[i2, i0] }"
+            },
+            {
+               "kind" : "read",
+               "relation" : "{ Stmt_bb12[i0, i1, i2] -> MemRef_beta[] }"
+            },
+            {
+               "kind" : "write",
+               "relation" : "{ Stmt_bb12[i0, i1, i2] -> MemRef_A[i0, i1] }"
+            }
+         ],
+         "domain" : "{ Stmt_bb12[i0, i1, i2] : 0 <= i0 <= 1055 and 0 <= i1 <= 1055 and 0 <= i2 <= 1023 }",
+         "name" : "Stmt_bb12",
+         "schedule" : "{ Stmt_bb12[i0, i1, i2] -> [i0, i1, i2] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportArrays/ia3___%bb9---%bb26.jscop.transformed
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportArrays/ia3___%25bb9---%25bb26.jscop.transformed?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportArrays/ia3___%bb9---%bb26.jscop.transformed (added)
+++ polly/trunk/test/JSONExporter/ImportArrays/ia3___%bb9---%bb26.jscop.transformed Wed May 24 10:09:35 2017
@@ -0,0 +1,51 @@
+{
+   "arrays" : [
+       {
+         "sizes" : [ "*", "1024" ],
+	 "type" : "double"
+      },
+      {
+         "name" : "MemRef_A",
+         "sizes" : [ "*", "1056" ],
+         "type" : "double"
+      },
+      {
+         "name" : "D",
+         "sizes" : [ "270336" ],
+         "type" : "double"
+      },
+      {
+         "name" : "E",
+         "sizes" : [ "270336", "200000" ],
+         "type" : "double"
+      },
+      {
+         "name" : "F",
+         "sizes" : [ "270336" ],
+         "type" : "i64"
+      }
+   ],
+   "context" : "{  :  }",
+   "name" : "%bb9---%bb26",
+   "statements" : [
+      {
+         "accesses" : [
+            {
+               "kind" : "read",
+               "relation" : "{ Stmt_bb12[i0, i1, i2] -> E[i2, i0] }"
+            },
+            {
+               "kind" : "read",
+               "relation" : "{ Stmt_bb12[i0, i1, i2] -> MemRef_beta[] }"
+            },
+            {
+               "kind" : "write",
+               "relation" : "{ Stmt_bb12[i0, i1, i2] -> MemRef_A[i0, i1] }"
+            }
+         ],
+         "domain" : "{ Stmt_bb12[i0, i1, i2] : 0 <= i0 <= 1055 and 0 <= i1 <= 1055 and 0 <= i2 <= 1023 }",
+         "name" : "Stmt_bb12",
+         "schedule" : "{ Stmt_bb12[i0, i1, i2] -> [i0, i1, i2] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportArrays/ia4___%bb9---%bb26.jscop.transformed
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportArrays/ia4___%25bb9---%25bb26.jscop.transformed?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportArrays/ia4___%bb9---%bb26.jscop.transformed (added)
+++ polly/trunk/test/JSONExporter/ImportArrays/ia4___%bb9---%bb26.jscop.transformed Wed May 24 10:09:35 2017
@@ -0,0 +1,52 @@
+{
+   "arrays" : [
+       {
+         "name" : "MemRef_B",
+         "sizes" : [ "*", "1024" ],
+	 "type" : "doble"
+      },
+      {
+         "name" : "MemRef_A",
+         "sizes" : [ "*", "1056" ],
+         "type" : "double"
+      },
+      {
+         "name" : "D",
+         "sizes" : [ "270336" ],
+         "type" : "double"
+      },
+      {
+         "name" : "E",
+         "sizes" : [ "270336", "200000" ],
+         "type" : "double"
+      },
+      {
+         "name" : "F",
+         "sizes" : [ "270336" ],
+         "type" : "i64"
+      }
+   ],
+   "context" : "{  :  }",
+   "name" : "%bb9---%bb26",
+   "statements" : [
+      {
+         "accesses" : [
+            {
+               "kind" : "read",
+               "relation" : "{ Stmt_bb12[i0, i1, i2] -> E[i2, i0] }"
+            },
+            {
+               "kind" : "read",
+               "relation" : "{ Stmt_bb12[i0, i1, i2] -> MemRef_beta[] }"
+            },
+            {
+               "kind" : "write",
+               "relation" : "{ Stmt_bb12[i0, i1, i2] -> MemRef_A[i0, i1] }"
+            }
+         ],
+         "domain" : "{ Stmt_bb12[i0, i1, i2] : 0 <= i0 <= 1055 and 0 <= i1 <= 1055 and 0 <= i2 <= 1023 }",
+         "name" : "Stmt_bb12",
+         "schedule" : "{ Stmt_bb12[i0, i1, i2] -> [i0, i1, i2] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportArrays/ia___%bb9---%bb26.jscop.transformed
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportArrays/ia___%25bb9---%25bb26.jscop.transformed?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportArrays/ia___%bb9---%bb26.jscop.transformed (added)
+++ polly/trunk/test/JSONExporter/ImportArrays/ia___%bb9---%bb26.jscop.transformed Wed May 24 10:09:35 2017
@@ -0,0 +1,51 @@
+{
+   "arrays" : [
+       {
+         "name" : "MemRef_B",
+         "sizes" : [ "*", "1024" ]
+      },
+      {
+         "name" : "MemRef_A",
+         "sizes" : [ "*", "1056" ],
+         "type" : "double"
+      },
+      {
+         "name" : "D",
+         "sizes" : [ "270336" ],
+         "type" : "double"
+      },
+      {
+         "name" : "E",
+         "sizes" : [ "270336", "200000" ],
+         "type" : "double"
+      },
+      {
+         "name" : "F",
+         "sizes" : [ "270336" ],
+         "type" : "i64"
+      }
+   ],
+   "context" : "{  :  }",
+   "name" : "%bb9---%bb26",
+   "statements" : [
+      {
+         "accesses" : [
+            {
+               "kind" : "read",
+               "relation" : "{ Stmt_bb12[i0, i1, i2] -> E[i2, i0] }"
+            },
+            {
+               "kind" : "read",
+               "relation" : "{ Stmt_bb12[i0, i1, i2] -> MemRef_beta[] }"
+            },
+            {
+               "kind" : "write",
+               "relation" : "{ Stmt_bb12[i0, i1, i2] -> MemRef_A[i0, i1] }"
+            }
+         ],
+         "domain" : "{ Stmt_bb12[i0, i1, i2] : 0 <= i0 <= 1055 and 0 <= i1 <= 1055 and 0 <= i2 <= 1023 }",
+         "name" : "Stmt_bb12",
+         "schedule" : "{ Stmt_bb12[i0, i1, i2] -> [i0, i1, i2] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportContext/ImportContext-Context-mispelled.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportContext/ImportContext-Context-mispelled.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportContext/ImportContext-Context-mispelled.ll (added)
+++ polly/trunk/test/JSONExporter/ImportContext/ImportContext-Context-mispelled.ll Wed May 24 10:09:35 2017
@@ -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 named 'context'.
+;
+; Verify if the JSONImporter check if there is a key name 'context'.
+;
+;    void ic(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 @ic(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
+}
+

Added: polly/trunk/test/JSONExporter/ImportContext/ImportContext-Not-parameter-set.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportContext/ImportContext-Not-parameter-set.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportContext/ImportContext-Not-parameter-set.ll (added)
+++ polly/trunk/test/JSONExporter/ImportContext/ImportContext-Not-parameter-set.ll Wed May 24 10:09:35 2017
@@ -0,0 +1,64 @@
+; RUN: opt %loadPolly -polly-import-jscop-dir=%S -polly-import-jscop -polly-ast -polly-ast-detect-parallel -analyze < %s 2>&1 >/dev/null | FileCheck %s 
+;
+; CHECK: The isl_set is not a parameter set.
+;
+; Verify if the JSONImporter check if the imported set is a parameter one.
+;
+;    void ic3(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 @ic3(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
+}
+

Added: polly/trunk/test/JSONExporter/ImportContext/ImportContext-Unvalid-Context.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportContext/ImportContext-Unvalid-Context.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportContext/ImportContext-Unvalid-Context.ll (added)
+++ polly/trunk/test/JSONExporter/ImportContext/ImportContext-Unvalid-Context.ll Wed May 24 10:09:35 2017
@@ -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 context was not parsed successfully by ISL.
+;
+; Verify if the JSONImporter check if the context is parsed successfully.
+;
+;    void ic2(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 @ic2(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
+}
+

Added: polly/trunk/test/JSONExporter/ImportContext/ImportContext-Wrong-dimension.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportContext/ImportContext-Wrong-dimension.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportContext/ImportContext-Wrong-dimension.ll (added)
+++ polly/trunk/test/JSONExporter/ImportContext/ImportContext-Wrong-dimension.ll Wed May 24 10:09:35 2017
@@ -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: Imported context has the wrong number of parameters : Found 2 Expected 1
+;
+; Verify if the JSONImporter check if there is the right number of parameters.
+;
+;    void ic4(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 @ic4(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
+}
+

Added: polly/trunk/test/JSONExporter/ImportContext/ic2___%for.cond---%for.end10.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportContext/ic2___%25for.cond---%25for.end10.jscop?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportContext/ic2___%for.cond---%for.end10.jscop (added)
+++ polly/trunk/test/JSONExporter/ImportContext/ic2___%for.cond---%for.end10.jscop Wed May 24 10:09:35 2017
@@ -0,0 +1,32 @@
+{
+   "context" : "[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] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportContext/ic3___%for.cond---%for.end10.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportContext/ic3___%25for.cond---%25for.end10.jscop?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportContext/ic3___%for.cond---%for.end10.jscop (added)
+++ polly/trunk/test/JSONExporter/ImportContext/ic3___%for.cond---%for.end10.jscop Wed May 24 10:09:35 2017
@@ -0,0 +1,32 @@
+{
+   "context" : "{ S[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] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportContext/ic4___%for.cond---%for.end10.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportContext/ic4___%25for.cond---%25for.end10.jscop?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportContext/ic4___%for.cond---%for.end10.jscop (added)
+++ polly/trunk/test/JSONExporter/ImportContext/ic4___%for.cond---%for.end10.jscop Wed May 24 10:09:35 2017
@@ -0,0 +1,32 @@
+{
+   "context" : "[n, m] -> {  : 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] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportContext/ic___%for.cond---%for.end10.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportContext/ic___%25for.cond---%25for.end10.jscop?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportContext/ic___%for.cond---%for.end10.jscop (added)
+++ polly/trunk/test/JSONExporter/ImportContext/ic___%for.cond---%for.end10.jscop Wed May 24 10:09:35 2017
@@ -0,0 +1,32 @@
+{
+   "cntext" : "[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] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-No-schedule-key.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-No-schedule-key.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-No-schedule-key.ll (added)
+++ polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-No-schedule-key.ll Wed May 24 10:09:35 2017
@@ -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 0 has no 'schedule' key.
+;
+; Verify if the JSONImporter check if there is a key name 'schedule'.
+;
+;    void is3(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 @is3(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
+}
+

Added: polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-Schedule-not-valid.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-Schedule-not-valid.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-Schedule-not-valid.ll (added)
+++ polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-Schedule-not-valid.ll Wed May 24 10:09:35 2017
@@ -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 schedule was not parsed successfully (index = 1).
+;
+; Verify if the JSONImporter check if the parsed schedule is valid.
+;
+;    void is4(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 @is4(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
+}
+

Added: polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-Statements-mispelled.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-Statements-mispelled.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-Statements-mispelled.ll (added)
+++ polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-Statements-mispelled.ll Wed May 24 10:09:35 2017
@@ -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 if the JSONImporter check if there is a key name 'statements'.
+;
+;    void is(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 @is(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
+}
+

Added: polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-Wrong-number-statements.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-Wrong-number-statements.ll?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-Wrong-number-statements.ll (added)
+++ polly/trunk/test/JSONExporter/ImportSchedule/ImportSchedule-Wrong-number-statements.ll Wed May 24 10:09:35 2017
@@ -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 if the JSONImporter check if there is the right number of statements.
+;
+;    void is2(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 @is2(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
+}
+

Added: polly/trunk/test/JSONExporter/ImportSchedule/is2___%for.cond---%for.end10.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportSchedule/is2___%25for.cond---%25for.end10.jscop?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportSchedule/is2___%for.cond---%for.end10.jscop (added)
+++ polly/trunk/test/JSONExporter/ImportSchedule/is2___%for.cond---%for.end10.jscop Wed May 24 10:09:35 2017
@@ -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] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportSchedule/is3___%for.cond---%for.end10.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportSchedule/is3___%25for.cond---%25for.end10.jscop?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportSchedule/is3___%for.cond---%for.end10.jscop (added)
+++ polly/trunk/test/JSONExporter/ImportSchedule/is3___%for.cond---%for.end10.jscop Wed May 24 10:09:35 2017
@@ -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"
+      },
+      {
+         "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] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportSchedule/is4___%for.cond---%for.end10.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportSchedule/is4___%25for.cond---%25for.end10.jscop?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportSchedule/is4___%for.cond---%for.end10.jscop (added)
+++ polly/trunk/test/JSONExporter/ImportSchedule/is4___%for.cond---%for.end10.jscop Wed May 24 10:09:35 2017
@@ -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" : "[] -> { Stmt_S1[i0] -> [1, n - i0, 0] }"
+      }
+   ]
+}

Added: polly/trunk/test/JSONExporter/ImportSchedule/is___%for.cond---%for.end10.jscop
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/JSONExporter/ImportSchedule/is___%25for.cond---%25for.end10.jscop?rev=303759&view=auto
==============================================================================
--- polly/trunk/test/JSONExporter/ImportSchedule/is___%for.cond---%for.end10.jscop (added)
+++ polly/trunk/test/JSONExporter/ImportSchedule/is___%for.cond---%for.end10.jscop Wed May 24 10:09:35 2017
@@ -0,0 +1,32 @@
+{
+   "context" : "[n] -> {  : n >= -2147483648 and n <= 2147483647 }",
+   "name" : "for.cond => for.end10",
+   "staements" : [
+      {
+         "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] }"
+      }
+   ]
+}




More information about the llvm-commits mailing list