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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 23 11:31:53 PDT 2023


nikic 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))
----------------
This check looks unnecessary.


================
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;
----------------
This seems simpler than the loop :)


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

https://reviews.llvm.org/D150970



More information about the llvm-commits mailing list