Build an ElementCount from loop vectorize width metadata, if present.

Synopsis

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

std::optional<ElementCount>
getOptionalElementCountLoopAttribute(Loop const* TheLoop);

Description

Find a combination of metadata ("llvm.loop.vectorize.width" and "llvm.loop.vectorize.scalable.enable") for a loop and use it to construct a ElementCount. If scalable.enable is present the count is scalable; if scalable.disable is present or the tag is absent, it is fixed‐width. If the metadata "llvm.loop.vectorize.width" cannot be found then std::nullopt is returned.

Return Value

The ElementCount from vectorize metadata, or std::nullopt if absent.

Parameters

Name

Description

TheLoop

Loop whose vectorize metadata is inspected.

Created with MrDocs