25#define DEBUG_TYPE "gc-empty-basic-blocks"
27STATISTIC(NumEmptyBlocksRemoved,
"Number of empty blocks removed");
38 return "Remove Empty Basic Blocks.";
55 MBB != LastMBB;
MBB = NextMBB) {
56 NextMBB = std::next(
MBB);
64 return !
MI.isPosition() && !
MI.isImplicitDef() && !
MI.isKill() &&
71 <<
" in function " << MF.
getName() <<
":\n"
75 for (
auto &Pred : Preds)
76 Pred->ReplaceUsesOfBlockWith(&*
MBB, &*NextMBB);
87 NumEmptyBlocksRemoved += NumRemoved;
88 return NumRemoved != 0;
93 "Removes empty basic blocks and redirects their uses to their "
94 "fallthrough blocks.",
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This file defines the SmallVector class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
bool isEHPad() const
Returns true if the block is a landing pad.
bool hasAddressTaken() const
Test whether this block is used as something other than the target of a terminator,...
void removeSuccessor(MachineBasicBlock *Succ, bool NormalizeSuccProbs=false)
Remove successor from the successors list of this MachineBasicBlock.
void eraseFromParent()
This method unlinks 'this' from the containing function and deletes it.
iterator_range< pred_iterator > predecessors()
StringRef getName() const
Return the name of the corresponding LLVM basic block, or an empty string.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
const MachineBasicBlock & back() const
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
Representation of each machine instruction.
bool ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New)
ReplaceMBBInJumpTables - If Old is the target of any jump tables, update the jump tables to branch to...
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
This is an optimization pass for GlobalISel generic memory operations.
MachineFunctionPass * createGCEmptyBasicBlocksPass()
createGCEmptyBasicblocksPass - Empty basic blocks (basic blocks without real code) appear as the resu...
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void initializeGCEmptyBasicBlocksPass(PassRegistry &)