llvm::combineMetadataForCSE

Combine metadata so one instruction can replace another after CSE.

Synopsis

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

void
combineMetadataForCSE(
    Instruction* K,
    Instruction const* J,
    bool DoesKMove);

Description

Combine the metadata of two instructions so that K can replace J. This specifically handles the case of CSE-like transformations. Some metadata can only be kept if K dominates J. For this to be correct, K cannot be hoisted.

Unknown metadata is removed.

Parameters

NameDescription
KSurviving instruction that may replace J.
JInstruction being replaced by K.
DoesKMoveWhether K may move relative to J.