diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-10-30 19:49:39 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-10-30 19:49:39 +0000 |
commit | 415f869cf30a272072c0533a2dea85496a210309 (patch) | |
tree | 2247a9569fd2d983c2c29032d559130478cc04b8 /lib/Transforms/Scalar | |
parent | 8a69a95f913dadae92d2ce0b3ac551610bf868e0 (diff) | |
download | external_llvm-415f869cf30a272072c0533a2dea85496a210309.zip external_llvm-415f869cf30a272072c0533a2dea85496a210309.tar.gz external_llvm-415f869cf30a272072c0533a2dea85496a210309.tar.bz2 |
LoopIdiom: Fix a serious missed optimization: we only turned top-level loops into memmove.
Thanks to Preston Briggs for catching this!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167045 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r-- | lib/Transforms/Scalar/LoopIdiomRecognize.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/lib/Transforms/Scalar/LoopIdiomRecognize.cpp index bc8ae66..249cb9d 100644 --- a/lib/Transforms/Scalar/LoopIdiomRecognize.cpp +++ b/lib/Transforms/Scalar/LoopIdiomRecognize.cpp @@ -555,10 +555,11 @@ processLoopStoreOfLoopLoad(StoreInst *SI, unsigned StoreSize, // can safely emit a memcpy. OwningPtr<Dependence> Dep(DA.depends(SI, LI, true)); if (Dep) { - // If there is a dependence but the direction is positive we can still - // safely turn this into memmove. - if (Dep->getLevels() != 1 || - Dep->getDirection(1) != Dependence::DVEntry::GT) + // If there is a dependence but the direction is positive (or none) we can + // still safely turn this into memmove. + unsigned Direction = Dep->getDirection(Dep->getLevels()); + if (Direction != Dependence::DVEntry::NONE && + Direction != Dependence::DVEntry::GT) return false; isMemcpySafe = false; } |