From 245b7f6ec26a8d27c984da4cceb7cfc27abcba6b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 18 Nov 2010 07:38:43 +0000 Subject: [PATCH] use AA::isNoAlias instead of open coding it. Remove an extraneous noalias check: there is no need to check to see if the source and dest of a memcpy are noalias, behavior is undefined if not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119691 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/MemCpyOptimizer.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/lib/Transforms/Scalar/MemCpyOptimizer.cpp index 39f40a1fb9d..cab8bac0f94 100644 --- a/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/lib/Transforms/Scalar/MemCpyOptimizer.cpp @@ -689,22 +689,18 @@ bool MemCpyOpt::processMemCpyMemCpyDependence(MemCpyInst *M, MemCpyInst *MDep, return false; // Finally, we have to make sure that the dest of the second does not - // alias the source of the first + // alias the source of the first. AliasAnalysis &AA = getAnalysis(); - if (AA.alias(M->getRawDest(), MSize, MDep->getRawSource(), DepSize) != - AliasAnalysis::NoAlias) - return false; - else if (AA.alias(M->getRawDest(), MSize, M->getRawSource(), MSize) != - AliasAnalysis::NoAlias) - return false; - else if (AA.alias(MDep->getRawDest(), DepSize, MDep->getRawSource(), DepSize) - != AliasAnalysis::NoAlias) + if (!AA.isNoAlias(M->getRawDest(), MSize, MDep->getRawSource(), DepSize) || + !AA.isNoAlias(M->getRawDest(), MSize, M->getRawSource(), MSize)) return false; // If all checks passed, then we can transform these memcpy's - const Type *ArgTys[3] = { M->getRawDest()->getType(), + const Type *ArgTys[3] = { + M->getRawDest()->getType(), MDep->getRawSource()->getType(), - M->getLength()->getType() }; + M->getLength()->getType() + }; Function *MemCpyFun = Intrinsic::getDeclaration(M->getParent()->getParent()->getParent(), M->getIntrinsicID(), ArgTys, 3);