llvm::replaceDominatedUsesWithIf

Conditionally replace uses dominated by a block's end with another value.

Synopsis

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

unsigned int
replaceDominatedUsesWithIf(
    Value* From,
    Value* To,
    DominatorTree& DT,
    BasicBlock const* BB,
    function_ref<bool(Use const&, Value const*)> ShouldReplace);

Description

Replace each use of 'From' with 'To' if that use is dominated by the end of the given BasicBlock and the callback ShouldReplace returns true. Returns the number of replacements made.

Return Value

Number of replacements made.

Parameters

NameDescription
FromValue whose dominated uses may be replaced.
ToReplacement value for selected uses.
DTDominator tree used to test block dominance.
BBBlock whose end must dominate a use for it to be considered.
ShouldReplacePredicate that selects which dominated uses to replace.