From 8d2ee55a0cdf6c6084a79a82199b809fc4a06b9a Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 27 Oct 2012 15:18:28 +0000 Subject: 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 --- llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib') 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(SI->getValueOperand()); -- cgit v1.2.3