[PATCH] D155406: [MemCpyOpt] implement multi BB stack-move optimization

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 00:08:37 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp:1682
+        (PDom && isModOrRefSet(AA->getModRefInfo(PDom, SrcLoc))) ? PDom
+                                                                 : nullptr;
+    if (PDom && PDom->isTerminator() && PDomUser) {
----------------
khei4 wrote:
> nikic wrote:
> > I don't get what you're doing here with AA. Why is this necessary now and wasn't needed in the single BB case?
> This was to know whether the post dominator has MemoryAccess on SrcAlloca.
> If it has MemoryAccess, check whether it's terminator or not, and find the place to insert MemoryAccess.
> If it's not, currently skipped because I can't know how to insert MemoryDef or MemoryPhi consistently with any post dominators.
Based on D157979, you can pass nullptr as the defining access and use createMemoryAccessInBB with `Begin` insertion place (when inserting at start of block).


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

https://reviews.llvm.org/D155406



More information about the llvm-commits mailing list