diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-10-27 15:18:28 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-10-27 15:18:28 +0000 |
commit | 8d2ee55a0cdf6c6084a79a82199b809fc4a06b9a (patch) | |
tree | 0a225befe808194365ce9718b0eda871bb7bdea0 /llvm/lib | |
parent | 2ea126e73e3827f046d7f74f025972ef559e9017 (diff) | |
download | bcm5719-llvm-8d2ee55a0cdf6c6084a79a82199b809fc4a06b9a.tar.gz bcm5719-llvm-8d2ee55a0cdf6c6084a79a82199b809fc4a06b9a.zip |
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.
llvm-svn: 166877
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp index 495d403e549..bc8ae660366 100644 --- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp +++ b/llvm/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()); |