Expand a scalable vector reduction into an element‐wise runtime loop.

Synopsis

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

Value*
expandReductionViaLoop(
    IRBuilderBase& Builder,
    Value* Vec,
    unsigned int RdxOpcode,
    Value* Acc,
    DominatorTree* DT = nullptr,
    LoopInfo* LI = nullptr);

Description

Expand a scalable vector reduction into a runtime loop that applies RdxOpcode element by element, starting from Acc as the initial accumulator value (typically the reduction identity). If DT and/or LI are provided, they are updated to reflect the new basic blocks.

Return Value

The reduced scalar value.

Parameters

Name

Description

Builder

IR builder positioned where the loop should be emitted.

Vec

Scalable vector value being reduced.

RdxOpcode

Opcode applied to each extracted element.

Acc

Initial accumulator / identity value.

DT

Optional dominator tree to update.

LI

Optional loop info to update.

Created with MrDocs