[PATCH] D136822: [InstCombine] Allow memcpys from constant memory to readonly noalias parameters to be elided.

Patrick Walton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 29 15:00:37 PDT 2022


pcwalton added inline comments.


================
Comment at: compiler-rt/test/asan/TestCases/printf-5.c:22
+  for (unsigned i = 0; i < sizeof(fmt); i++)
+    fmt[i] = "%c %d %f %s\n"[i];
   printf((char *)fmt, c, x, f, s);
----------------
nikic wrote:
> I'm really confused by what this test is trying to do with the memcpy here. Would the test pass with just `volatile char fmt[2] = "%c"`? That'll produce a volatile memcpy, and that shouldn't get optimized away.
Turns out that InstCombine was optimizing away volatile memcpys. I fixed that, added a new test for it, and then made the change you suggested.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136822



More information about the llvm-commits mailing list