[PATCH] D86808: [MachineDCE] Delete missed dead instructions after deleting PHI

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 13:02:03 PDT 2020


nemanjai created this revision.
nemanjai added reviewers: eli.friedman, sunfish, MatzeB, PowerPC.
Herald added subscribers: danielkiss, hiraditya.
Herald added a project: LLVM.
nemanjai requested review of this revision.

Machine DCE does a linear bottom-up pass to detect dead instructions and delete them. The idea with the bottom-up traversal is to delete instructions before their inputs so that removal of a single user makes the def instruction dead.

This however does not work if the only user of an instruction is a PHI in a loop header. With this patch, DCE tracks instructions that have become dead when removing a PHI. At the end, if any of those still exist in their parent MBB, they're also deleted.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86808

Files:
  llvm/lib/CodeGen/DeadMachineInstructionElim.cpp
  llvm/test/CodeGen/PowerPC/dce-phi-inputs.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86808.288682.patch
Type: text/x-patch
Size: 5531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200828/5eb19c6d/attachment.bin>


More information about the llvm-commits mailing list