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

Kohei Asano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 01:34:23 PDT 2023


khei4 added a comment.

> It looks like a clang-format of the whole file snuck in.

Ah, ... sorry for the noise.



================
Comment at: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp:1682
+        (PDom && isModOrRefSet(AA->getModRefInfo(PDom, SrcLoc))) ? PDom
+                                                                 : nullptr;
+    if (PDom && PDom->isTerminator() && PDomUser) {
----------------
nikic wrote:
> 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).
Sounds great! Thank you! I'll handle it.


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

https://reviews.llvm.org/D155406



More information about the llvm-commits mailing list