[PATCH] D100870: [MemCpyOpt] Allow variable lengths in memcpy optimizer

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 20 13:38:14 PDT 2021


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp:1254
 
-  if (IntrinsicInst *II =
-          dyn_cast_or_null<IntrinsicInst>(Def->getMemoryInst())) {
-    if (II->getIntrinsicID() == Intrinsic::lifetime_start) {
-      ConstantInt *LTSize = cast<ConstantInt>(II->getArgOperand(0));
-      if (AA->isMustAlias(V, II->getArgOperand(1)) &&
-          LTSize->getZExtValue() >= Size->getZExtValue())
-        return true;
+  if (ConstantInt *CSize = dyn_cast<ConstantInt>(Size)) {
+    if (IntrinsicInst *II =
----------------
The constant size is only needed for the isMustAlias case below. The other one can work with a dynamic size.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100870/new/

https://reviews.llvm.org/D100870



More information about the llvm-commits mailing list