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

Anshil Gandhi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 11 13:29:33 PST 2022


gandhi21299 updated this revision to Diff 481948.
gandhi21299 marked an inline comment as done.
gandhi21299 added a comment.

- Eliminated LastPHI as it had no valuable impact
- Removed the addrspace cast checks in isOnlyCopiedFromConstantMemory(..) as pointed out. Instead, determine if the alloca is directly used as an incoming value in a PHI while

collecting users of an alloca in PointerReplacer::collectUsers(..). If the address spaces of the PHI and the destination of the Copy inst differ and there is a direct use of the 
alloca, an addrspace cast will be required to further allow the PHI for replacement. Since we do not allow for addrspace casts, reject the PHI at that moment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136201

Files:
  llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
  llvm/test/Transforms/InstCombine/replace-alloca-phi.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136201.481948.patch
Type: text/x-patch
Size: 14243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221211/56c4e75b/attachment.bin>


More information about the llvm-commits mailing list