[FIX] Do not try to hoist memory intrinsic
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>
Thu, 17 Nov 2016 22:11:56 +0000 (22:11 +0000)
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>
Thu, 17 Nov 2016 22:11:56 +0000 (22:11 +0000)
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
polly/lib/Analysis/ScopInfo.cpp

index ceb7071..4e92cbf 100644 (file)
@@ -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<MemIntrinsic>(getAccessInstruction());
+  }
+
   /// Check if a new access relation was imported or set by a pass.
   bool hasNewAccessRelation() const { return NewAccessRelation; }
 
index 1858d4a..cb26e9c 100644 (file)
@@ -676,7 +676,7 @@ void MemoryAccess::assumeNoOutOfBound() {
 }
 
 void MemoryAccess::buildMemIntrinsicAccessRelation() {
-  assert(isa<MemIntrinsic>(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