[PATCH] D153453: [MemCpyOpt] implement single BB stack-move optimization which unify the static unescaped allocas

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 18:29:46 PDT 2023


vitalybuka accepted this revision.
vitalybuka added a comment.
This revision is now accepted and ready to land.

Looks strange that we add lifetime markers on alloca which has no markers before.
Can't create counterexample, precondition blocks transformation.



================
Comment at: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp:72
 STATISTIC(NumCallSlot,    "Number of call slot optimizations performed");
+STATISTIC(NumStackMove, "Number of stack-move optimizations performed");
 
----------------
misaligned, clang-format please?


================
Comment at: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp:1529
+            // since both llvm.lifetime.start and llvm.lifetime.end intrinsics
+            // conceptually fill all the bytes of the alloca with an undefined
+            // value.
----------------
they also mark when object is considered alive/dead


================
Comment at: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp:1532
+            int64_t Size = cast<ConstantInt>(UI->getOperand(0))->getSExtValue();
+            if (Size < 0 || Size == DestSize) {
+              LifetimeMarkers.push_back(UI);
----------------
why do we need this condition?


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

https://reviews.llvm.org/D153453



More information about the llvm-commits mailing list