llvm::ConstantFoldIntegerCast

Constant fold a zext, sext or trunc, depending on IsSigned and whether the DestTy is wider or narrower than C. Returns nullptr on failure.

Synopsis

Declared in <llvm/Analysis/ConstantFolding.h>

Constant*
ConstantFoldIntegerCast(
    Constant* C,
    Type* DestTy,
    bool IsSigned,
    DataLayout const& DL);

Return Value

The folded integer cast result, or null on failure.

Parameters

NameDescription
CInteger constant to cast.
DestTyDestination integer type.
IsSignedWhether to treat the value as signed (sext vs zext).
DLData layout used for type sizes and pointer widths.