llvm::ConstantFoldUnaryIntOp

Constant-fold a unary integer operation on Src.

Synopsis

Declared in <llvm/CodeGen/GlobalISel/Utils.h>

SmallVector<APInt>
ConstantFoldUnaryIntOp(
    unsigned int Opcode,
    LLT DstTy,
    Register Src,
    MachineRegisterInfo const& MRI);

Description

Tries to constant fold a unary integer operation (G_CTLZ, G_CTTZ, G_CTPOP and their _ZERO_POISON variants, G_ABS, G_BSWAP, G_BITREVERSE) on Src. If Src is a vector then it tries to do an element-wise constant fold.

Return Value

The folded element values.

Parameters

NameDescription
OpcodeUnary integer opcode to fold.
DstTyDestination type of the operation.
SrcSource operand register.
MRIRegister information for the function.