llvm::ConstantFoldBinOp

Constant-fold a generic integer binary opcode on two register operands.

Synopsis

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

std::optional<APInt>
ConstantFoldBinOp(
    unsigned int Opcode,
    Register const Op1,
    Register const Op2,
    MachineRegisterInfo const& MRI);

Return Value

The folded APInt, or std::nullopt on failure.

Parameters

NameDescription
OpcodeGeneric integer binary opcode to fold.
Op1First operand register.
Op2Second operand register.
MRIRegister information for the function.