forked from OSchip/llvm-project
Relax assert when setting access functions with invariant base pointers
Summary: Instead of forbidding such access functions completely, we verify that their base pointer has been hoisted and only assert in case the base pointer was not hoisted. I was trying for a little while to get a test case that ensures the assert is correctly fired in case of invariant load hoisting being disabled, but I could not find a good way to do so, as llvm-lit immediately aborts if a command yields a non-zero return value. As we do not generally test our asserts, not having a test case here seems OK. This resolves http://llvm.org/PR31494 Suggested-by: Michael Kruse <llvm@meinersbur.de> Reviewers: efriedma, jdoerfert, Meinersbur, gareevroman, sebpop, zinob, huihuiz, pollydev Reviewed By: Meinersbur Differential Revision: https://reviews.llvm.org/D28798 llvm-svn: 292213
This commit is contained in:
parent
e5cfc67113
commit
e1ff0cf2eb
|
@ -1078,16 +1078,24 @@ void MemoryAccess::setNewAccessRelation(__isl_take isl_map *NewAccess) {
|
|||
isl_set_free(NewDomain);
|
||||
isl_set_free(StmtDomain);
|
||||
|
||||
// Check whether access dimensions correspond to number of dimensions of the
|
||||
// accesses array.
|
||||
auto *NewAccessSpace = isl_space_range(NewSpace);
|
||||
assert(isl_space_has_tuple_id(NewAccessSpace, isl_dim_set) &&
|
||||
"Must specify the array that is accessed");
|
||||
auto *NewArrayId = isl_space_get_tuple_id(NewAccessSpace, isl_dim_set);
|
||||
auto *SAI = static_cast<ScopArrayInfo *>(isl_id_get_user(NewArrayId));
|
||||
assert(SAI && "Must set a ScopArrayInfo");
|
||||
assert(!SAI->getBasePtrOriginSAI() &&
|
||||
"Indirect array not supported by codegen");
|
||||
|
||||
if (SAI->isArrayKind() && SAI->getBasePtrOriginSAI()) {
|
||||
InvariantEquivClassTy *EqClass =
|
||||
getStatement()->getParent()->lookupInvariantEquivClass(
|
||||
SAI->getBasePtr());
|
||||
assert(EqClass &&
|
||||
"Access functions to indirect arrays must have an invariant and "
|
||||
"hoisted base pointer");
|
||||
}
|
||||
|
||||
// Check whether access dimensions correspond to number of dimensions of the
|
||||
// accesses array.
|
||||
auto Dims = SAI->getNumberOfDimensions();
|
||||
assert(isl_space_dim(NewAccessSpace, isl_dim_set) == Dims &&
|
||||
"Access dims must match array dims");
|
||||
|
|
|
@ -759,8 +759,6 @@ IslNodeBuilder::createNewAccesses(ScopStmt *Stmt,
|
|||
}
|
||||
assert(MA->isAffine() &&
|
||||
"Only affine memory accesses can be code generated");
|
||||
assert(!MA->getLatestScopArrayInfo()->getBasePtrOriginSAI() &&
|
||||
"Generating new index expressions to indirect arrays not working");
|
||||
|
||||
auto Schedule = isl_ast_build_get_schedule(Build);
|
||||
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
; RUN: opt %loadPolly -polly-import-jscop -polly-import-jscop-dir=%S \
|
||||
; RUN: -polly-codegen -analyze 2 >&1 < %s | FileCheck %s
|
||||
|
||||
; XFAIL: *
|
||||
; RUN: -polly-codegen -polly-invariant-load-hoisting -S \
|
||||
; RUN: 2>&1 < %s | FileCheck %s
|
||||
|
||||
; Setting new access functions where the base pointer of the array that is newly
|
||||
; accessed is only loaded within the scop itself caused incorrect code to be
|
||||
; generated when invariant load hoisting is disabled. Since r282893 we assert
|
||||
; in such situations. This test case was added to demonstrate what needs to be
|
||||
; resolved to support such access functions.
|
||||
; generated when invariant load hoisting is disabled. This test case checks
|
||||
; that in case invariant load hoisting is enabled, we generate correct code.
|
||||
|
||||
; CHECK: %polly.access.polly.access.X.load = getelementptr float, float* %polly.access.X.load, i64 %polly.indvar
|
||||
|
||||
|
|
Loading…
Reference in New Issue