llvm::getOrEnforceKnownAlignment

Try to ensure that the alignment of V is at least PrefAlign bytes. If the owning object can be modified and has an alignment less than PrefAlign, it will be increased and PrefAlign returned. If the alignment cannot be increased, the known alignment of the value is returned.

Synopsis

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

Align
getOrEnforceKnownAlignment(
    Value* V,
    MaybeAlign PrefAlign,
    DataLayout const& DL,
    Instruction const* CxtI = nullptr,
    AssumptionCache* AC = nullptr,
    DominatorTree const* DT = nullptr);

Description

It is not always possible to modify the alignment of the underlying object, so if alignment is important, a more reliable approach is to simply align all global variables and allocation instructions to their preferred alignment from the beginning.

Return Value

This struct is a compact representation of a valid (non-zero power of two) alignment. It is suitable for use as static global constants.

Parameters

NameDescription
VLLVM Value Representation
PrefAlignThis struct is a compact representation of a valid (power of two) or undefined (0) alignment.
DLA parsed version of the target data layout string in and methods for querying it.
ACA cache of @llvm.assume calls within a function.
DTConcrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.