We now compute the invalid context of memory accesses only for the domain under
which the memory access is executed. Without limiting ourselves to this
restricted domain, invalid accesses outside of the domain of actually executed
statement instances may result in the execution domain of the statement to
become empty despite the fact that the statement will actually be executed. As a
result, such scops would use unitialized values for their computations which
results in incorrect computations.
This fixes http://llvm.org/PR27944 and unbreaks the
-polly-position=before-vectorizer buildbots.
llvm-svn: 275053
__isl_give isl_pw_aff *MemoryAccess::getPwAff(const SCEV *E) {
auto *Stmt = getStatement();
PWACtx PWAC = Stmt->getParent()->getPwAff(E, Stmt->getEntryBlock());
- InvalidDomain = isl_set_union(InvalidDomain, PWAC.second);
+ isl_set *StmtDom = isl_set_reset_tuple_id(getStatement()->getDomain());
+ isl_set *NewInvalidDom = isl_set_intersect(StmtDom, PWAC.second);
+ InvalidDomain = isl_set_union(InvalidDomain, NewInvalidDom);
return PWAC.first;
}