LLVM: llvm::CmpPredicate Class Reference (original) (raw)
An abstraction over a floating-point predicate, and a pack of an integer predicate with samesign information. More...
#include "[llvm/IR/CmpPredicate.h](CmpPredicate%5F8h%5Fsource.html)"
| Public Member Functions | |
|---|---|
| CmpPredicate () | |
| Default constructor. | |
| CmpPredicate (CmpInst::Predicate Pred, bool HasSameSign=false) | |
| Constructed implictly with a either Predicate and samesign information, or just a Predicate, dropping samesign information. | |
| operator CmpInst::Predicate () const | |
| Implictly converts to the underlying Predicate, dropping samesign information. | |
| bool | hasSameSign () const |
| Query samesign information, for optimizations. | |
| CmpInst::Predicate | dropSameSign () const |
| Drops samesign information. | |
| LLVM_ABI CmpInst::Predicate | getPreferredSignedPredicate () const |
| Attempts to return a signed CmpInst::Predicate from the CmpPredicate. | |
| bool | operator== (CmpInst::Predicate P) const |
| An operator== on the underlying Predicate. | |
| bool | operator!= (CmpInst::Predicate P) const |
| bool | operator== (CmpPredicate) const =delete |
| There is no operator== defined on CmpPredicate. | |
| bool | operator!= (CmpPredicate) const =delete |
| Static Public Member Functions | |
|---|---|
| static LLVM_ABI std::optional< CmpPredicate > | getMatching (CmpPredicate A, CmpPredicate B) |
| Compares two CmpPredicates taking samesign into account and returns the canonicalized CmpPredicate if they match. | |
| static LLVM_ABI CmpPredicate | get (const CmpInst *Cmp) |
| Do a ICmpInst::getCmpPredicate() or CmpInst::getPredicate(), as appropriate. | |
| static LLVM_ABI CmpPredicate | getSwapped (CmpPredicate P) |
| Get the swapped predicate of a CmpPredicate. | |
| static LLVM_ABI CmpPredicate | getSwapped (const CmpInst *Cmp) |
| Get the swapped predicate of a CmpInst. |
An abstraction over a floating-point predicate, and a pack of an integer predicate with samesign information.
Some functions in ICmpInst construct and return this type in place of a Predicate.
Definition at line 23 of file CmpPredicate.h.
| llvm::CmpPredicate::CmpPredicate ( ) | inline |
|---|
◆ CmpPredicate() [2/2]
◆ dropSameSign()
◆ get()
Do a ICmpInst::getCmpPredicate() or CmpInst::getPredicate(), as appropriate.
Definition at line 4043 of file Instructions.cpp.
References CmpPredicate(), and llvm::dyn_cast().
Referenced by getSwapped(), llvm::PatternMatch::CmpClass_match< LHS_t, RHS_t, Class, Commutable >::match(), and llvm::PatternMatch::SpecificCmpClass_match< LHS_t, RHS_t, Class, Commutable >::match().
◆ getMatching()
Compares two CmpPredicates taking samesign into account and returns the canonicalized CmpPredicate if they match.
An alternative to operator==.
For example, samesign ult + samesign ult -> samesign ult samesign ult + ult -> ult samesign ult + slt -> slt ult + ult -> ult ult + slt -> std::nullopt
Definition at line 4024 of file Instructions.cpp.
References A(), B(), CmpPredicate(), llvm::ICmpInst::getFlippedSignednessPredicate(), and llvm::CmpInst::isFPPredicate().
Referenced by llvm::InstCombinerImpl::foldSelectOpOp(), hoistMinMax(), isImpliedCondICmps(), isImpliedTrueByMatchingCmp(), llvm::PatternMatch::SpecificCmpClass_match< LHS_t, RHS_t, Class, Commutable >::match(), and llvm::VPlanPatternMatch::SpecificCmp_match< Op0_t, Op1_t, Opcodes >::match().
◆ getPreferredSignedPredicate()
◆ getSwapped() [1/2]
Get the swapped predicate of a CmpPredicate.
Definition at line 4049 of file Instructions.cpp.
References CmpPredicate(), llvm::CmpInst::getSwappedPredicate(), and P.
Referenced by getSwapped(), llvm::PatternMatch::CmpClass_match< LHS_t, RHS_t, Class, Commutable >::match(), llvm::PatternMatch::SpecificCmpClass_match< LHS_t, RHS_t, Class, Commutable >::match(), and llvm::InstCombinerImpl::visitICmpInst().
◆ getSwapped() [2/2]
◆ hasSameSign()
| bool llvm::CmpPredicate::hasSameSign ( ) const | inline |
|---|
◆ operator CmpInst::Predicate()
◆ operator!=() [1/2]
◆ operator!=() [2/2]
◆ operator==() [1/2]
◆ operator==() [2/2]
The documentation for this class was generated from the following files:
- include/llvm/IR/CmpPredicate.h
- lib/IR/Instructions.cpp