[FIX] Keep a copy of the Domain set in the SCEVAffinator

llvm-svn: 246397
This commit is contained in:
Johannes Doerfert 2015-08-30 19:52:06 +00:00
parent 2fc50df900
commit b1e3bbb7c9
1 changed files with 7 additions and 4 deletions

View File

@ -30,8 +30,10 @@ SCEVAffinator::SCEVAffinator(Scop *S)
: S(S), Ctx(S->getIslCtx()), R(S->getRegion()), SE(*S->getSE()) {}
SCEVAffinator::~SCEVAffinator() {
for (const auto &CachedPair : CachedExpressions)
for (const auto &CachedPair : CachedExpressions) {
isl_pw_aff_free(CachedPair.second);
isl_set_free(CachedPair.first.second);
}
}
__isl_give isl_pw_aff *SCEVAffinator::getPwAff(const SCEV *Expr,
@ -50,11 +52,12 @@ __isl_give isl_pw_aff *SCEVAffinator::getPwAff(const SCEV *Expr,
__isl_give isl_pw_aff *SCEVAffinator::visit(const SCEV *Expr) {
auto Key = std::make_pair(Expr, Domain);
auto Key = std::make_pair(Expr, isl_set_copy(Domain));
isl_pw_aff *PWA = CachedExpressions[Key];
if (PWA)
if (PWA) {
isl_set_free(Domain);
return isl_pw_aff_copy(PWA);
}
// In case the scev is a valid parameter, we do not further analyze this
// expression, but create a new parameter in the isl_pw_aff. This allows us