From c97654681e652f2d1acfe6f8e1d22214ef20d8de Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Thu, 17 Nov 2016 22:11:56 +0000 Subject: [PATCH] [FIX] Do not try to hoist memory intrinsic Since we do not necessarily treat memory intrinsics as non-affine anymore, we have to check for them explicitly before we try to hoist an access. llvm-svn: 287270 --- polly/include/polly/ScopInfo.h | 5 +++++ polly/lib/Analysis/ScopInfo.cpp | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h index ceb7071..4e92cbf 100644 --- a/polly/include/polly/ScopInfo.h +++ b/polly/include/polly/ScopInfo.h @@ -747,6 +747,11 @@ public: /// Is this a write memory access? bool isWrite() const { return isMustWrite() || isMayWrite(); } + /// Is this a memory intrinsic access (memcpy, memset, memmove)? + bool isMemoryIntrinsic() const { + return isa(getAccessInstruction()); + } + /// Check if a new access relation was imported or set by a pass. bool hasNewAccessRelation() const { return NewAccessRelation; } diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index 1858d4a..cb26e9c 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -676,7 +676,7 @@ void MemoryAccess::assumeNoOutOfBound() { } void MemoryAccess::buildMemIntrinsicAccessRelation() { - assert(isa(getAccessInstruction())); + assert(isMemoryIntrinsic()); assert(Subscripts.size() == 2 && Sizes.size() == 1); auto *SubscriptPWA = getPwAff(Subscripts[0]); @@ -3487,7 +3487,8 @@ __isl_give isl_set *Scop::getNonHoistableCtx(MemoryAccess *Access, auto &Stmt = *Access->getStatement(); BasicBlock *BB = Stmt.getEntryBlock(); - if (Access->isScalarKind() || Access->isWrite() || !Access->isAffine()) + if (Access->isScalarKind() || Access->isWrite() || !Access->isAffine() || + Access->isMemoryIntrinsic()) return nullptr; // Skip accesses that have an invariant base pointer which is defined but -- 2.7.4