summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-10-30 19:49:39 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-10-30 19:49:39 +0000
commit48a6478242fd28723a69802f7b46a588df85608b (patch)
tree9ec59f11caa48550b3b07cf25719904c2c7ade7a /llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
parent2eaadd1a2d25ddf1238cbb0767eccb6171e331dd (diff)
downloadbcm5719-llvm-48a6478242fd28723a69802f7b46a588df85608b.tar.gz
bcm5719-llvm-48a6478242fd28723a69802f7b46a588df85608b.zip
LoopIdiom: Fix a serious missed optimization: we only turned top-level loops into memmove.
Thanks to Preston Briggs for catching this! llvm-svn: 167045
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
index bc8ae660366..249cb9dcaaf 100644
--- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud