forked from OSchip/llvm-project
[JSON] Make the failure to parse a jscop file a hard error
Summary: Before, if we fail to parse a jscop file, this will be reported as an error and importing is aborted. However, this isn't actually strong enough, since although the import is aborted, the scop has already been modified and is very likely broken. Instead, make this a hard failure and throw an LLVM error. This new behaviour requires small changes to the tests for the legacy pass, namely using `not` to verify the error. Further, fixed the jscop file for the base_pointer_load_is_inst_inside_invariant_1 testcase. Reviewed By: Meinersbur Split out of D36578. llvm-svn: 310599
This commit is contained in:
parent
8dfe8e21e8
commit
c3bcdc2f1a
|
@ -388,7 +388,8 @@ importAccesses(Scop &S, Json::Value &JScop, const DataLayout &DL,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether the number of indices equals the number of memory accesses
|
// Check whether the number of indices equals the number of memory
|
||||||
|
// accesses
|
||||||
if (Stmt.size() != statements[StatementIdx]["accesses"].size()) {
|
if (Stmt.size() != statements[StatementIdx]["accesses"].size()) {
|
||||||
errs() << "The number of memory accesses in the JSop file and the number "
|
errs() << "The number of memory accesses in the JSop file and the number "
|
||||||
"of memory accesses differ for index "
|
"of memory accesses differ for index "
|
||||||
|
@ -430,8 +431,8 @@ importAccesses(Scop &S, Json::Value &JScop, const DataLayout &DL,
|
||||||
|
|
||||||
// If the NewAccessMap has zero dimensions, it is the scalar access; it
|
// If the NewAccessMap has zero dimensions, it is the scalar access; it
|
||||||
// must be the same as before.
|
// must be the same as before.
|
||||||
// If it has at least one dimension, it's an array access; search for its
|
// If it has at least one dimension, it's an array access; search for
|
||||||
// ScopArrayInfo.
|
// its ScopArrayInfo.
|
||||||
if (isl_map_dim(NewAccessMap, isl_dim_out) >= 1) {
|
if (isl_map_dim(NewAccessMap, isl_dim_out) >= 1) {
|
||||||
NewOutId = isl_map_get_tuple_id(NewAccessMap, isl_dim_out);
|
NewOutId = isl_map_get_tuple_id(NewAccessMap, isl_dim_out);
|
||||||
auto *SAI = S.getArrayInfoByName(isl_id_get_name(NewOutId));
|
auto *SAI = S.getArrayInfoByName(isl_id_get_name(NewOutId));
|
||||||
|
@ -781,7 +782,10 @@ bool JSONImporter::runOnScop(Scop &S) {
|
||||||
const Dependences &D =
|
const Dependences &D =
|
||||||
getAnalysis<DependenceInfo>().getDependences(Dependences::AL_Statement);
|
getAnalysis<DependenceInfo>().getDependences(Dependences::AL_Statement);
|
||||||
const DataLayout &DL = S.getFunction().getParent()->getDataLayout();
|
const DataLayout &DL = S.getFunction().getParent()->getDataLayout();
|
||||||
importScop(S, D, DL, &NewAccessStrings);
|
|
||||||
|
if (!importScop(S, D, DL, &NewAccessStrings))
|
||||||
|
report_fatal_error("Tried to import a malformed jscop file.");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -800,7 +804,8 @@ PreservedAnalyses JSONImportPass::run(Scop &S, ScopAnalysisManager &SAM,
|
||||||
Dependences::AL_Statement);
|
Dependences::AL_Statement);
|
||||||
const DataLayout &DL = S.getFunction().getParent()->getDataLayout();
|
const DataLayout &DL = S.getFunction().getParent()->getDataLayout();
|
||||||
|
|
||||||
importScop(S, D, DL);
|
if (!importScop(S, D, DL))
|
||||||
|
report_fatal_error("Tried to import a malformed jscop file.");
|
||||||
|
|
||||||
// This invalidates all analyses on Scop.
|
// This invalidates all analyses on Scop.
|
||||||
PreservedAnalyses PA;
|
PreservedAnalyses PA;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -analyze 2>&1 < %s | FileCheck %s
|
; RUN: not opt %loadPolly -polly-import-jscop -analyze 2>&1 < %s | FileCheck %s
|
||||||
;
|
;
|
||||||
; Check that we do not allow to access elements not accessed before because the
|
; Check that we do not allow to access elements not accessed before because the
|
||||||
; alignment information would become invalid.
|
; alignment information would become invalid.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
; RUN: not opt %loadPolly -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.
|
; CHECK: The access was not parsed successfully by ISL.
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
; RUN: not opt %loadPolly -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.
|
; CHECK: Statement from JScop file has no key name 'accesses' for index 1.
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
; RUN: not opt %loadPolly -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.
|
; CHECK: The number of memory accesses in the JSop file and the number of memory accesses differ for index 0.
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
; RUN: not opt %loadPolly -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.
|
; CHECK: The number of indices and the number of statements differ.
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
; RUN: not opt %loadPolly -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.
|
; CHECK: Memory access number 0 has no key name 'relation' for statement number 1.
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
; RUN: not opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
||||||
;
|
;
|
||||||
; CHECK: JScop file has no key name 'statements'.
|
; CHECK: JScop file has no key name 'statements'.
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
; RUN: not opt %loadPolly -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
|
; CHECK: JScop file contains access function with undeclared ScopArrayInfo
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
; RUN: not opt %loadPolly -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.
|
; CHECK: JScop file changes the number of parameter dimensions.
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-scops -analyze -polly-import-jscop -polly-import-jscop-postfix=transformed < %s 2>&1 | FileCheck %s
|
; RUN: not opt %loadPolly -polly-scops -analyze -polly-import-jscop -polly-import-jscop-postfix=transformed < %s 2>&1 | FileCheck %s
|
||||||
;
|
;
|
||||||
; CHECK: Array has not a valid type.
|
; CHECK: Array has not a valid type.
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-scops -analyze -polly-import-jscop -polly-import-jscop-postfix=transformed < %s 2>&1 | FileCheck %s
|
; RUN: not opt %loadPolly -polly-scops -analyze -polly-import-jscop -polly-import-jscop-postfix=transformed < %s 2>&1 | FileCheck %s
|
||||||
;
|
;
|
||||||
; #define Ni 1056
|
; #define Ni 1056
|
||||||
; #define Nj 1056
|
; #define Nj 1056
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-scops -analyze -polly-import-jscop -polly-import-jscop-postfix=transformed < %s 2>&1 | FileCheck %s
|
; RUN: not opt %loadPolly -polly-scops -analyze -polly-import-jscop -polly-import-jscop-postfix=transformed < %s 2>&1 | FileCheck %s
|
||||||
;
|
;
|
||||||
; CHECK: Array has no key 'name'.
|
; CHECK: Array has no key 'name'.
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-scops -analyze -polly-import-jscop -polly-import-jscop-postfix=transformed < %s 2>&1 | FileCheck %s
|
; RUN: not opt %loadPolly -polly-scops -analyze -polly-import-jscop -polly-import-jscop-postfix=transformed < %s 2>&1 | FileCheck %s
|
||||||
;
|
;
|
||||||
; CHECK: Array has no key 'sizes'.
|
; CHECK: Array has no key 'sizes'.
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-scops -analyze -polly-import-jscop -polly-import-jscop-postfix=transformed < %s 2>&1 | FileCheck %s
|
; RUN: not opt %loadPolly -polly-scops -analyze -polly-import-jscop -polly-import-jscop-postfix=transformed < %s 2>&1 | FileCheck %s
|
||||||
;
|
;
|
||||||
; CHECK: Array has no key 'type'.
|
; CHECK: Array has no key 'type'.
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
; RUN: not opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
||||||
;
|
;
|
||||||
; CHECK: JScop file has no key named 'context'.
|
; CHECK: JScop file has no key named 'context'.
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel -analyze < %s 2>&1 >/dev/null | FileCheck %s
|
; RUN: not opt %loadPolly -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.
|
; CHECK: The isl_set is not a parameter set.
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
; RUN: not opt %loadPolly -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.
|
; CHECK: The context was not parsed successfully by ISL.
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
; RUN: not opt %loadPolly -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
|
; CHECK: Imported context has the wrong number of parameters : Found 2 Expected 1
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
; RUN: not opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
||||||
;
|
;
|
||||||
; CHECK: Statement 0 has no 'schedule' key.
|
; CHECK: Statement 0 has no 'schedule' key.
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
; RUN: not opt %loadPolly -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).
|
; CHECK: The schedule was not parsed successfully (index = 1).
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
; RUN: not opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
||||||
;
|
;
|
||||||
; CHECK: JScop file has no key name 'statements'.
|
; CHECK: JScop file has no key name 'statements'.
|
||||||
;
|
;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel < %s 2>&1 >/dev/null | FileCheck %s
|
; RUN: not opt %loadPolly -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.
|
; CHECK: The number of indices and the number of statements differ.
|
||||||
;
|
;
|
||||||
|
|
|
@ -16,10 +16,6 @@
|
||||||
"statements" : [
|
"statements" : [
|
||||||
{
|
{
|
||||||
"accesses" : [
|
"accesses" : [
|
||||||
{
|
|
||||||
"kind" : "read",
|
|
||||||
"relation" : "[n] -> { Stmt_S1[i0] -> MemRef_A[0] }"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"kind" : "write",
|
"kind" : "write",
|
||||||
"relation" : "[n] -> { Stmt_S1[i0] -> MemRef_ptr[i0+1] }"
|
"relation" : "[n] -> { Stmt_S1[i0] -> MemRef_ptr[i0+1] }"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; RUN: opt %loadPolly -polly-import-jscop -polly-import-jscop-postfix=transformed -polly-simplify -analyze < %s | FileCheck %s -match-full-lines
|
; RUN: opt %loadPolly -polly-simplify -analyze < %s | FileCheck %s -match-full-lines
|
||||||
;
|
;
|
||||||
; Do not remove redundant stores in the middle of region statements.
|
; Do not remove redundant stores in the middle of region statements.
|
||||||
; The store in region_true could be removed, but in practice we do try to
|
; The store in region_true could be removed, but in practice we do try to
|
||||||
|
|
Loading…
Reference in New Issue