|
LLVM 24.0.0git
|
Helper class that determines whether a list of integer comparisons can share a single predicate. More...
#include "Transforms/Vectorize/SLPVectorizer/SLPCompatibilityAnalysis.h"
Public Member Functions | |
| bool | add (const Instruction *I) |
Intersects the convertible predicate set of the comparison lane I (an icmp or a trunc to i1) with the running set. | |
| CmpInst::Predicate | getPredicate (const ICmpInst *Preferred) const |
Returns the shared predicate, preferring the predicate of Preferred when the whole list can use it, or BAD_ICMP_PREDICATE when the list cannot share a natively present predicate. | |
Static Public Member Functions | |
| static CmpInst::Predicate | getSharedPredicate (ArrayRef< Value * > VL, const ICmpInst *Preferred) |
| Returns the predicate the whole list can share, or BAD_ICMP_PREDICATE when it cannot share a natively present predicate. | |
| static bool | isBitTest (const Instruction *I) |
Checks if the comparison lane I is the bit test of the single use and A, B != 0 or and A, B == 0, or trunc X to i1, which is and X, 1 != 0. | |
| static bool | canConvertTo (const Instruction *I, CmpInst::Predicate Pred) |
Checks if the comparison lane I can be expressed with the predicate Pred by adjusting its constant operand. | |
| static Constant * | getAdjustedConstant (const Instruction *I, CmpInst::Predicate Pred) |
Returns the adjusted constant operand expressing the comparison lane I with the predicate Pred, or nullptr if not convertible or if I is a compare already using Pred. | |
Helper class that determines whether a list of integer comparisons can share a single predicate.
InstCombine canonicalizes single-element and single-complement range comparisons to eq/ne at the type boundaries (e.g. x <u 1 becomes x == 0); such lanes are interchangeable with the rest of the list by adjusting the compared constant. InstCombine also canonicalizes icmp ne (and X, 1), 0 to trunc X to i1, such lanes are treated as the original comparison or as icmp eq (and X, 1), 1.
Definition at line 143 of file SLPCompatibilityAnalysis.h.
| bool llvm::slpvectorizer::CmpSamePredicateHelper::add | ( | const Instruction * | I | ) |
Intersects the convertible predicate set of the comparison lane I (an icmp or a trunc to i1) with the running set.
Returns false when the intersection becomes empty.
Definition at line 465 of file SLPCompatibilityAnalysis.cpp.
References llvm::dyn_cast(), and I.
Referenced by getSharedPredicate().
|
static |
Checks if the comparison lane I can be expressed with the predicate Pred by adjusting its constant operand.
Definition at line 495 of file SLPCompatibilityAnalysis.cpp.
References I, and llvm::CmpInst::isIntPredicate().
Referenced by getAdjustedConstant(), and llvm::slpvectorizer::getSameOpcode().
|
static |
Returns the adjusted constant operand expressing the comparison lane I with the predicate Pred, or nullptr if not convertible or if I is a compare already using Pred.
Definition at line 500 of file SLPCompatibilityAnalysis.cpp.
References assert(), C(), canConvertTo(), llvm::dyn_cast(), llvm::slpvectorizer::getCmpBoundaryFamily(), llvm::slpvectorizer::getLaneConstantCmp(), I, llvm::CmpInst::ICMP_EQ, and llvm::isa().
Referenced by llvm::slpvectorizer::convertTo().
| CmpInst::Predicate llvm::slpvectorizer::CmpSamePredicateHelper::getPredicate | ( | const ICmpInst * | Preferred | ) | const |
Returns the shared predicate, preferring the predicate of Preferred when the whole list can use it, or BAD_ICMP_PREDICATE when the list cannot share a natively present predicate.
Definition at line 473 of file SLPCompatibilityAnalysis.cpp.
References llvm::CmpInst::BAD_ICMP_PREDICATE, llvm::countr_zero(), llvm::CmpInst::getPredicate(), and llvm::CmpInst::ICMP_EQ.
Referenced by getSharedPredicate().
|
static |
Returns the predicate the whole list can share, or BAD_ICMP_PREDICATE when it cannot share a natively present predicate.
Definition at line 484 of file SLPCompatibilityAnalysis.cpp.
References add(), llvm::all_of(), llvm::CmpInst::BAD_ICMP_PREDICATE, llvm::dyn_cast(), getPredicate(), I, and llvm::isa().
Referenced by llvm::slpvectorizer::getSameOpcode().
|
static |
Checks if the comparison lane I is the bit test of the single use and A, B != 0 or and A, B == 0, or trunc X to i1, which is and X, 1 != 0.
Definition at line 452 of file SLPCompatibilityAnalysis.cpp.
References llvm::dyn_cast(), llvm::slpvectorizer::getCmpBoundaryFamily(), llvm::slpvectorizer::getLaneConstantCmp(), I, llvm::PatternMatch::m_And(), llvm::MIPatternMatch::m_OneUse(), llvm::PatternMatch::m_Value(), and llvm::PatternMatch::match().
Referenced by llvm::slpvectorizer::getSameOpcode().