From 5329277f8141aaecc63573ce98ccb14ffdb68401 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Mon, 11 Jul 2016 12:01:26 +0000 Subject: [PATCH] load hoisting: compute memory access invalid context only for domain 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 --- polly/lib/Analysis/ScopInfo.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index 68fb070..187ab25 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -869,7 +869,9 @@ void MemoryAccess::dump() const { print(errs()); } __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; } -- 2.7.4