[PATCH] D140089: [MemCpyOpt] Add a stack-move optimization to opportunistically merge allocas together, disabled by default.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 15 03:40:48 PST 2022


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp:75
+    "memcpyopt-stack-move-threshold", cl::Hidden,
+    cl::desc("Enable stack-move optimization with the given max "
+             "basic block threshold"),
----------------
xbolva00 wrote:
> Lets avoid yet another off by default oprimization..
Setting this to 8, I see no compile-time impact and very little codegen impact on CTMark -- looks like this optimization just doesn't trigger on C/C++ code. So I don't think we need to be concerned about enabling it by default.


================
Comment at: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp:2130
+    if (AllocaInst *DestAlloca =
+            dyn_cast<AllocaInst>(M->getDest()->stripPointerCastsAndAliases())) {
+      if (AllocaInst *SrcAlloca = dyn_cast<AllocaInst>(
----------------
stripPointerCasts() is sufficient. You'll never get an alloca looking through aliases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140089



More information about the llvm-commits mailing list