[llvm-commits] [llvm] r119691 - /llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp

Chris Lattner sabre at nondot.org
Wed Nov 17 23:38:43 PST 2010


Author: lattner
Date: Thu Nov 18 01:38:43 2010
New Revision: 119691

URL: http://llvm.org/viewvc/llvm-project?rev=119691&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=119691&r1=119690&r2=119691&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Thu Nov 18 01:38:43 2010
@@ -689,22 +689,18 @@
     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<AliasAnalysis>();
-  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);





More information about the llvm-commits mailing list