DeadMachineInstructionElim
这个 Pass 从名字上看比较好理解,和中端似乎很相似。代码量不大,一百多行。入口我们就不看了,处理流程为:
bool DeadMachineInstructionElimImpl::eliminateDeadMI(MachineFunction &MF) {
bool AnyChanges = false;
// Loop over all instructions in all blocks, from bottom to top, so that it's
// more likely that chains of dependent but ultimately dead instructions will // be cleaned up. for (MachineBasicBlock *MBB : post_order(&MF)) {
LivePhysRegs.addLiveOuts(*MBB);
// Now scan ...