|
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 Value *V) |
Intersects the convertible predicate set of the comparison lane V (an icmp, a trunc to i1 or an i1 constant) 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 Value *V, CmpInst::Predicate Pred) |
Checks if the comparison lane V 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. | |
| static SmallVector< Value * > | getConstantLaneOperands (const Value *V, const ICmpInst *Cmp) |
Returns the constant operands expressing the i1 constant lane V as the comparison Cmp. | |
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. An i1 constant lane is the comparison of constants with any predicate.
Definition at line 146 of file SLPCompatibilityAnalysis.h.
Intersects the convertible predicate set of the comparison lane V (an icmp, a trunc to i1 or an i1 constant) with the running set.
Returns false when the intersection becomes empty.
Definition at line 477 of file SLPCompatibilityAnalysis.cpp.
References llvm::dyn_cast().
Referenced by getSharedPredicate().
|
static |
Checks if the comparison lane V can be expressed with the predicate Pred by adjusting its constant operand.
Definition at line 505 of file SLPCompatibilityAnalysis.cpp.
References llvm::CmpInst::isIntPredicate().
Referenced by getAdjustedConstant(), getConstantLaneOperands(), llvm::slpvectorizer::getSameOpcode(), and llvm::slpvectorizer::InstructionsState::isCopyableElement().
|
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 510 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().
|
static |
Returns the constant operands expressing the i1 constant lane V as the comparison Cmp.
Definition at line 528 of file SLPCompatibilityAnalysis.cpp.
References assert(), canConvertTo(), llvm::ICmpInst::compare(), llvm::dyn_cast(), llvm::isa(), and llvm_unreachable.
| 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 485 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 496 of file SLPCompatibilityAnalysis.cpp.
References add(), llvm::all_of(), llvm::CmpInst::BAD_ICMP_PREDICATE, getPredicate(), 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 464 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().