aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2011-01-21 22:07:57 +0000
committerDan Gohman <gohman@apple.com>2011-01-21 22:07:57 +0000
commit8fb25c53bdc22a1f480ac0a6c0215a23f397deb3 (patch)
treeb2cdfd68bc01d2252d2b6b0f9fa03ec2825ffafe /lib/Transforms
parentfc3faa75cbadd8a1020941ec85adfda1d2f49688 (diff)
downloadexternal_llvm-8fb25c53bdc22a1f480ac0a6c0215a23f397deb3.zip
external_llvm-8fb25c53bdc22a1f480ac0a6c0215a23f397deb3.tar.gz
external_llvm-8fb25c53bdc22a1f480ac0a6c0215a23f397deb3.tar.bz2
Actually check memcpy lengths, instead of just commenting about
how they should be checked. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123999 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/MemCpyOptimizer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/lib/Transforms/Scalar/MemCpyOptimizer.cpp
index 0d3c5c7..acddf08 100644
--- a/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ b/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -690,8 +690,10 @@ bool MemCpyOpt::processMemCpyMemCpyDependence(MemCpyInst *M, MemCpyInst *MDep,
// Second, the length of the memcpy's must be the same, or the preceeding one
// must be larger than the following one.
- ConstantInt *C1 = dyn_cast<ConstantInt>(MDep->getLength());
- if (!C1) return false;
+ ConstantInt *MDepLen = dyn_cast<ConstantInt>(MDep->getLength());
+ ConstantInt *MLen = dyn_cast<ConstantInt>(M->getLength());
+ if (!MDepLen || !MLen || MDepLen->getZExtValue() < MLen->getZExtValue())
+ return false;
AliasAnalysis &AA = getAnalysis<AliasAnalysis>();