From 8fb25c53bdc22a1f480ac0a6c0215a23f397deb3 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 21 Jan 2011 22:07:57 +0000 Subject: 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 --- lib/Transforms/Scalar/MemCpyOptimizer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/Transforms') 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(MDep->getLength()); - if (!C1) return false; + ConstantInt *MDepLen = dyn_cast(MDep->getLength()); + ConstantInt *MLen = dyn_cast(M->getLength()); + if (!MDepLen || !MLen || MDepLen->getZExtValue() < MLen->getZExtValue()) + return false; AliasAnalysis &AA = getAnalysis(); -- cgit v1.1