1 //===-- UnreachableBlockElim.h - Remove unreachable blocks for codegen --===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This pass is an extremely simple version of the SimplifyCFG pass. Its sole
10 // job is to delete LLVM basic blocks that are not reachable from the entry
11 // node. To do this, it performs a simple depth first traversal of the CFG,
12 // then deletes any unvisited nodes.
14 // Note that this pass is really a hack. In particular, the instruction
15 // selectors for various targets should just not generate code for unreachable
16 // blocks. Until LLVM has a more systematic way of defining instruction
17 // selectors, however, we cannot really expect them to handle additional
20 //===----------------------------------------------------------------------===//
22 #ifndef LLVM_LIB_CODEGEN_UNREACHABLEBLOCKELIM_H
23 #define LLVM_LIB_CODEGEN_UNREACHABLEBLOCKELIM_H
25 #include "llvm/IR/PassManager.h"
29 class UnreachableBlockElimPass
30 : public PassInfoMixin
<UnreachableBlockElimPass
> {
32 PreservedAnalyses
run(Function
&F
, FunctionAnalysisManager
&AM
);
34 } // end namespace llvm
36 #endif // LLVM_LIB_CODEGEN_UNREACHABLEBLOCKELIM_H