1 //===-- UnreachableBlockElim.h - Remove unreachable blocks for codegen --===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This pass is an extremely simple version of the SimplifyCFG pass. Its sole
11 // job is to delete LLVM basic blocks that are not reachable from the entry
12 // node. To do this, it performs a simple depth first traversal of the CFG,
13 // then deletes any unvisited nodes.
15 // Note that this pass is really a hack. In particular, the instruction
16 // selectors for various targets should just not generate code for unreachable
17 // blocks. Until LLVM has a more systematic way of defining instruction
18 // selectors, however, we cannot really expect them to handle additional
21 //===----------------------------------------------------------------------===//
23 #ifndef LLVM_LIB_CODEGEN_UNREACHABLEBLOCKELIM_H
24 #define LLVM_LIB_CODEGEN_UNREACHABLEBLOCKELIM_H
26 #include "llvm/IR/PassManager.h"
30 class UnreachableBlockElimPass
31 : public PassInfoMixin<UnreachableBlockElimPass> {
33 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
35 } // end namespace llvm
37 #endif // LLVM_LIB_CODEGEN_UNREACHABLEBLOCKELIM_H