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

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 10:35:00 PST 2022


arsenm added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:335-336
+          NewTy->getPointerAddressSpace()) {
+        V = AddrSpaceCastInst::CreatePointerBitCastOrAddrSpaceCast(
+            V, NewTy, V->getName(), NewPHI);
+        PtrCastInserted = true;
----------------
gandhi21299 wrote:
> arsenm wrote:
> > In general InstCombine can't introduce a new address space cast when one didn't exist in the first place 
> If an incoming value is eligible to be replaced with a pointer from a different addrspace, other incoming values likely do not belong to the addrspace. This makes addrspacecast unavoidable.
Right, so I'm saying that would just make this illegal and you need to check the address spaces match. Is there a situation where we would want this to happen, that also isn't possible after InferAddressSpaces?


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