llvm::decomposeBitTestICmp

Decompose an icmp into the form ((X & Mask) pred C) if possible.

Synopsis

Declared in <llvm/Analysis/CmpInstAnalysis.h>

std::optional<DecomposedBitTest>
decomposeBitTestICmp(
    Value* LHS,
    Value* RHS,
    CmpInst::Predicate Pred,
    bool LookThroughTrunc = true,
    bool AllowNonZeroC = false,
    bool DecomposeAnd = false);

Description

Unless AllowNonZeroC is true, C will always be 0. If DecomposeAnd is specified, then, for equality predicates, this will decompose bitmasking via and.

Return Value

Decomposed bit-test form when possible; otherwise std::nullopt.

Parameters

NameDescription
LHSLeft-hand operand of the icmp.
RHSRight-hand operand of the icmp.
PredPredicate of the icmp to decompose.
LookThroughTruncWhen true, look through truncates on the operands.
AllowNonZeroCWhen true, allow a non-zero constant C.
DecomposeAndWhen true, decompose equality bitmasking via and.