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.