Create a new branch_weights metadata node and add or overwrite a prof metadata reference to instruction I.

Synopsis

Declared in <llvm/IR/ProfDataUtils.h>

void
setBranchWeights(
    Instruction& I,
    ArrayRef<uint32_t> Weights,
    bool IsExpected,
    bool ElideAllZero = false);

Parameters

Name

Description

I

the Instruction to set branch weights on.

Weights

an array of weights to set on instruction I.

IsExpected

were these weights added from an llvm.expect* intrinsic.

ElideAllZero

if true, drop profile metadata when all weights are zero.

Created with MrDocs