llvm::FoldSingleEntryPHINodes

Fold away single-entry PHI nodes in a block with one predecessor.

Synopsis

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

bool
FoldSingleEntryPHINodes(
    BasicBlock* BB,
    MemoryDependenceResults* MemDep = nullptr);

Description

We know that BB has one predecessor. If there are any single-entry PHI nodes in it, fold them away. This handles the case when all entries to the PHI nodes in a block are guaranteed equal, such as when the block has exactly one predecessor.

Return Value

True if any single-entry PHI nodes were folded away.

Parameters

NameDescription
BBBlock whose single-entry PHIs may be folded.
MemDepOptional memory-dependence results to update.