[PATCH] D136201: [InstCombine] Handle PHI nodes when eliminating constant memcpy

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 12 00:57:01 PST 2022


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:111
       MemTransferInst *MI = dyn_cast<MemTransferInst>(I);
-      if (!MI)
+      if (!MI || isa<PHINode>(MI->getDest()))
         return false;
----------------
This is not sufficient: E.g. consider doing the memcpy to an addrspacecast of the phi or similar. I think what we'd need instead is that set `IsOffset=true` for phi nodes, so we'll recursively reject memcpys into it. Of course we would need a different name than IsOffset in that case. It would more generally indicate that the pointer is not equivalent to the base.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136201



More information about the llvm-commits mailing list