[PATCH] D150970: (WIP) [MemCpyOpt]remove memcpy on noalias readonly attributed arguments

Kohei Asano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 00:52:20 PDT 2023


khei4 added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp:1732
             MadeChange |= processByValArgument(*CB, i);
+          else if (auto *F = CB->getCalledFunction()) {
+            if (!CB->onlyReadsMemory(i))
----------------
nikic wrote:
> This check looks unnecessary.
Thanks! That's remaining for the past diff!


================
Comment at: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp:1733-1738
+            if (!CB->onlyReadsMemory(i))
+              continue;
+            for (Attribute::AttrKind Kind :
+                 {Attribute::NoAlias, Attribute::NoCapture})
+              if (!CB->paramHasAttr(i, Kind))
+                continue;
----------------
nikic wrote:
> This seems simpler than the loop :)
Yeah, agreed, conditions are simpler than before.


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

https://reviews.llvm.org/D150970



More information about the llvm-commits mailing list