1303231Sdim//===-- UnreachableBlockElim.h - Remove unreachable blocks for codegen --===//
2303231Sdim//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6303231Sdim//
7303231Sdim//===----------------------------------------------------------------------===//
8303231Sdim//
9303231Sdim// This pass is an extremely simple version of the SimplifyCFG pass.  Its sole
10303231Sdim// job is to delete LLVM basic blocks that are not reachable from the entry
11303231Sdim// node.  To do this, it performs a simple depth first traversal of the CFG,
12303231Sdim// then deletes any unvisited nodes.
13303231Sdim//
14303231Sdim// Note that this pass is really a hack.  In particular, the instruction
15303231Sdim// selectors for various targets should just not generate code for unreachable
16303231Sdim// blocks.  Until LLVM has a more systematic way of defining instruction
17303231Sdim// selectors, however, we cannot really expect them to handle additional
18303231Sdim// complexity.
19303231Sdim//
20303231Sdim//===----------------------------------------------------------------------===//
21303231Sdim
22303231Sdim#ifndef LLVM_LIB_CODEGEN_UNREACHABLEBLOCKELIM_H
23303231Sdim#define LLVM_LIB_CODEGEN_UNREACHABLEBLOCKELIM_H
24303231Sdim
25303231Sdim#include "llvm/IR/PassManager.h"
26303231Sdim
27303231Sdimnamespace llvm {
28303231Sdim
29303231Sdimclass UnreachableBlockElimPass
30303231Sdim    : public PassInfoMixin<UnreachableBlockElimPass> {
31303231Sdimpublic:
32303231Sdim  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
33303231Sdim};
34303231Sdim} // end namespace llvm
35303231Sdim
36303231Sdim#endif // LLVM_LIB_CODEGEN_UNREACHABLEBLOCKELIM_H
37