summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-10-27 15:18:28 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-10-27 15:18:28 +0000
commitbadffcf8fddf3978acf9843a43e66766e9e830c6 (patch)
tree14095ac554d0100cdb8f797d6d44b409b8641c37 /lib
parentd11c5d08a5f4f030d6e357378d0d46d93efd9a59 (diff)
downloadllvm-badffcf8fddf3978acf9843a43e66766e9e830c6.tar.gz
llvm-badffcf8fddf3978acf9843a43e66766e9e830c6.tar.bz2
llvm-badffcf8fddf3978acf9843a43e66766e9e830c6.tar.xz
LoopIdiom: Add checks to avoid turning memmove into an infinite loop.
I don't think this is possible with the current implementation but that may change eventually. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166877 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/LoopIdiomRecognize.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
index 495d403e54..bc8ae66036 100644
--- a/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ b/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -178,7 +178,7 @@ bool LoopIdiomRecognize::runOnLoop(Loop *L, LPPassManager &LPM) {
// Disable loop idiom recognition if the function's name is a common idiom.
StringRef Name = L->getHeader()->getParent()->getName();
- if (Name == "memset" || Name == "memcpy")
+ if (Name == "memset" || Name == "memcpy" || Name == "memmove")
return false;
// The trip count of the loop must be analyzable.
@@ -524,7 +524,7 @@ processLoopStoreOfLoopLoad(StoreInst *SI, unsigned StoreSize,
const SCEVAddRecExpr *LoadEv,
const SCEV *BECount) {
// If we're not allowed to form memcpy, we fail.
- if (!TLI->has(LibFunc::memcpy))
+ if (!TLI->has(LibFunc::memcpy) || !TLI->has(LibFunc::memmove))
return false;
LoadInst *LI = cast<LoadInst>(SI->getValueOperand());