[PATCH] D107605: [MemCpyOpt] Teach memcpyopt to handle loads from the constant memory.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 5 16:09:07 PDT 2021


efriedma added a comment.

Makes sense.



================
Comment at: llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp:1571
+                     MemoryLocation::getForSource(M)) &&
+      !AA->pointsToConstantMemory(MemoryLocation::getForSource(M)))
     return false;
----------------
Is it possible to write this using getModRefInfo()?  Something like `if (isModSet(AA->getModRefInfo(M, MemoryLocation::getForSource(M))))`.


================
Comment at: llvm/test/Transforms/MemCpyOpt/memset-memcpy-redundant-memset.ll:21
+  call void @llvm.memset.p0i8.i64(i8* %dst, i8 %c, i64 %dst_size, i1 false)
+  %src = getelementptr inbounds [0 x i8], [0 x i8]* @C, i64 0, i64 undef
+  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %src_size, i1 false)
----------------
Please don't use undef here, or in the other tests.  It might lead to confusing results in the future.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107605



More information about the llvm-commits mailing list