diff options
author | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2016-03-24 13:50:04 +0000 |
---|---|---|
committer | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2016-03-24 13:50:04 +0000 |
commit | 733ea34f38d0c545f46e2d891a88f2677614912d (patch) | |
tree | 56d0879f7c1189f7ada5a19939f0f0fc3b779e3f /polly/lib/Analysis/ScopDetection.cpp | |
parent | 8ff253bfbffdaefb84d9b3edb0677ddedd6fc049 (diff) | |
download | bcm5719-llvm-733ea34f38d0c545f46e2d891a88f2677614912d.tar.gz bcm5719-llvm-733ea34f38d0c545f46e2d891a88f2677614912d.zip |
[FIX] Handle accesses to "null" in MemIntrinsics
This fixes PR27035. While we now exclude MemIntrinsics from the
polyhedral model if they would access "null" we could exploit this
even more, e.g., remove all parameter combinations that would lead to
the execution of this statement from the context.
llvm-svn: 264284
Diffstat (limited to 'polly/lib/Analysis/ScopDetection.cpp')
-rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index 2ceb3fa62dc..7810b94c4e5 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -533,17 +533,21 @@ bool ScopDetection::isValidIntrinsicInst(IntrinsicInst &II, case llvm::Intrinsic::memmove: case llvm::Intrinsic::memcpy: AF = SE->getSCEVAtScope(cast<MemTransferInst>(II).getSource(), L); - BP = dyn_cast<SCEVUnknown>(SE->getPointerBase(AF)); - // Bail if the source pointer is not valid. - if (!isValidAccess(&II, AF, BP, Context)) - return false; + if (!AF->isZero()) { + BP = dyn_cast<SCEVUnknown>(SE->getPointerBase(AF)); + // Bail if the source pointer is not valid. + if (!isValidAccess(&II, AF, BP, Context)) + return false; + } // Fall through case llvm::Intrinsic::memset: AF = SE->getSCEVAtScope(cast<MemIntrinsic>(II).getDest(), L); - BP = dyn_cast<SCEVUnknown>(SE->getPointerBase(AF)); - // Bail if the destination pointer is not valid. - if (!isValidAccess(&II, AF, BP, Context)) - return false; + if (!AF->isZero()) { + BP = dyn_cast<SCEVUnknown>(SE->getPointerBase(AF)); + // Bail if the destination pointer is not valid. + if (!isValidAccess(&II, AF, BP, Context)) + return false; + } // Bail if the length is not affine. if (!isAffine(SE->getSCEVAtScope(cast<MemIntrinsic>(II).getLength(), L), L, |