llvm::CmpPredicate::getMatching

Compares two CmpPredicates taking samesign into account and returns the canonicalized CmpPredicate if they match. An alternative to operator==.

Synopsis

Declared in <llvm/IR/CmpPredicate.h>

static
std::optional<CmpPredicate>
getMatching(
    CmpPredicate A,
    CmpPredicate B);

Description

For example, samesign ult + samesign ult -> samesign ult samesign ult + ult -> ult samesign ult + slt -> slt ult + ult -> ult ult + slt -> std::nullopt

Return Value

The canonicalized matching CmpPredicate, or std::nullopt if they do not match.

Parameters

NameDescription
AThe first CmpPredicate.
BThe second CmpPredicate.