llvm::EliminateUnreachableBlocks

Delete all basic blocks in F that are unreachable from its entry.

Synopsis

Declared in <llvm/Transforms/Utils/BasicBlockUtils.h>

bool
EliminateUnreachableBlocks(
    Function& F,
    DomTreeUpdater* DTU = nullptr,
    bool KeepOneInputPHIs = false);

Description

If KeepOneInputPHIs is true, one-input Phis in successors of blocks being deleted will be preserved.

Return Value

True if any unreachable blocks were deleted.

Parameters

NameDescription
FFunction whose unreachable blocks are deleted.
DTUOptional dominator-tree updater for CFG changes.
KeepOneInputPHIsWhether to preserve one-input PHIs in successors.