Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/CodeGen/UnreachableBlockElim.cpp
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | void UnreachableMachineBlockElim::getAnalysisUsage(AnalysisUsage &AU) const { | ||||
AU.addPreserved<MachineDominatorTree>(); | AU.addPreserved<MachineDominatorTree>(); | ||||
MachineFunctionPass::getAnalysisUsage(AU); | MachineFunctionPass::getAnalysisUsage(AU); | ||||
} | } | ||||
bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) { | bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) { | ||||
df_iterator_default_set<MachineBasicBlock*> Reachable; | df_iterator_default_set<MachineBasicBlock*> Reachable; | ||||
bool ModifiedPHI = false; | bool ModifiedPHI = false; | ||||
MMI = getAnalysisIfAvailable<MachineModuleInfo>(); | auto *MMIWP = getAnalysisIfAvailable<MachineModuleInfoWrapperPass>(); | ||||
MMI = MMIWP ? &MMIWP->getMMI() : nullptr; | |||||
MachineDominatorTree *MDT = getAnalysisIfAvailable<MachineDominatorTree>(); | MachineDominatorTree *MDT = getAnalysisIfAvailable<MachineDominatorTree>(); | ||||
MachineLoopInfo *MLI = getAnalysisIfAvailable<MachineLoopInfo>(); | MachineLoopInfo *MLI = getAnalysisIfAvailable<MachineLoopInfo>(); | ||||
// Mark all reachable blocks. | // Mark all reachable blocks. | ||||
for (MachineBasicBlock *BB : depth_first_ext(&F, Reachable)) | for (MachineBasicBlock *BB : depth_first_ext(&F, Reachable)) | ||||
(void)BB/* Mark all reachable blocks */; | (void)BB/* Mark all reachable blocks */; | ||||
// Loop over all dead blocks, remembering them and deleting all instructions | // Loop over all dead blocks, remembering them and deleting all instructions | ||||
▲ Show 20 Lines • Show All 96 Lines • Show Last 20 Lines |