LLVM  13.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::InductionDescriptor Class Reference

A struct for saving information about induction variables. More...

#include "llvm/Analysis/IVDescriptors.h"

Public Types

enum  InductionKind { IK_NoInduction, IK_IntInduction, IK_PtrInduction, IK_FpInduction }
 This enum represents the kinds of inductions that we support. More...
 

Public Member Functions

 InductionDescriptor ()=default
 Default constructor - creates an invalid induction. More...
 
ValuegetStartValue () const
 
InductionKind getKind () const
 
const SCEVgetStep () const
 
BinaryOperatorgetInductionBinOp () const
 
ConstantIntgetConstIntStepValue () const
 
InstructiongetExactFPMathInst ()
 Returns floating-point induction operator that does not allow reassociation (transforming the induction requires an override of normal floating-point rules). More...
 
Instruction::BinaryOps getInductionOpcode () const
 Returns binary opcode of the induction operator. More...
 
const SmallVectorImpl< Instruction * > & getCastInsts () const
 Returns a reference to the type cast instructions in the induction update chain, that are redundant when guarded with a runtime SCEV overflow check. More...
 

Static Public Member Functions

static bool isInductionPHI (PHINode *Phi, const Loop *L, ScalarEvolution *SE, InductionDescriptor &D, const SCEV *Expr=nullptr, SmallVectorImpl< Instruction * > *CastsToIgnore=nullptr)
 Returns true if Phi is an induction in the loop L. More...
 
static bool isFPInductionPHI (PHINode *Phi, const Loop *L, ScalarEvolution *SE, InductionDescriptor &D)
 Returns true if Phi is a floating point induction in the loop L. More...
 
static bool isInductionPHI (PHINode *Phi, const Loop *L, PredicatedScalarEvolution &PSE, InductionDescriptor &D, bool Assume=false)
 Returns true if Phi is a loop L induction, in the context associated with the run-time predicate of PSE. More...
 

Detailed Description

A struct for saving information about induction variables.

Definition at line 268 of file IVDescriptors.h.

Member Enumeration Documentation

◆ InductionKind

This enum represents the kinds of inductions that we support.

Enumerator
IK_NoInduction 

Not an induction variable.

IK_IntInduction 

Integer induction variable. Step = C.

IK_PtrInduction 

Pointer induction var. Step = C / sizeof(elem).

IK_FpInduction 

Floating point induction variable.

Definition at line 271 of file IVDescriptors.h.

Constructor & Destructor Documentation

◆ InductionDescriptor()

llvm::InductionDescriptor::InductionDescriptor ( )
default

Default constructor - creates an invalid induction.

Referenced by isFPInductionPHI(), and isInductionPHI().

Member Function Documentation

◆ getCastInsts()

const SmallVectorImpl<Instruction *>& llvm::InductionDescriptor::getCastInsts ( ) const
inline

Returns a reference to the type cast instructions in the induction update chain, that are redundant when guarded with a runtime SCEV overflow check.

Definition at line 335 of file IVDescriptors.h.

Referenced by llvm::LoopVectorizationPlanner::collectTriviallyDeadInstructions(), and llvm::LoopVectorizationCostModel::collectValuesToIgnore().

◆ getConstIntStepValue()

ConstantInt * InductionDescriptor::getConstIntStepValue ( ) const

Definition at line 1004 of file IVDescriptors.cpp.

Referenced by llvm::Loop::isCanonical().

◆ getExactFPMathInst()

Instruction* llvm::InductionDescriptor::getExactFPMathInst ( )
inline

Returns floating-point induction operator that does not allow reassociation (transforming the induction requires an override of normal floating-point rules).

Definition at line 319 of file IVDescriptors.h.

References llvm::Instruction::hasAllowReassoc(), and IK_FpInduction.

Referenced by llvm::LoopVectorizationLegality::canVectorizeFPMath().

◆ getInductionBinOp()

BinaryOperator* llvm::InductionDescriptor::getInductionBinOp ( ) const
inline

◆ getInductionOpcode()

Instruction::BinaryOps llvm::InductionDescriptor::getInductionOpcode ( ) const
inline

Returns binary opcode of the induction operator.

Definition at line 327 of file IVDescriptors.h.

References llvm::BinaryOperator::getOpcode().

Referenced by llvm::Loop::isAuxiliaryInductionVariable(), and llvm::Loop::isCanonical().

◆ getKind()

InductionKind llvm::InductionDescriptor::getKind ( ) const
inline

◆ getStartValue()

Value* llvm::InductionDescriptor::getStartValue ( ) const
inline

◆ getStep()

const SCEV* llvm::InductionDescriptor::getStep ( ) const
inline

◆ isFPInductionPHI()

bool InductionDescriptor::isFPInductionPHI ( PHINode Phi,
const Loop L,
ScalarEvolution SE,
InductionDescriptor D 
)
static

◆ isInductionPHI() [1/2]

bool InductionDescriptor::isInductionPHI ( PHINode Phi,
const Loop L,
PredicatedScalarEvolution PSE,
InductionDescriptor D,
bool  Assume = false 
)
static

Returns true if Phi is a loop L induction, in the context associated with the run-time predicate of PSE.

If Assume is true, this can add further SCEV predicates to PSE in order to prove that Phi is an induction. If Phi is an induction, D will contain the data describing this induction.

Definition at line 1168 of file IVDescriptors.cpp.

References D, llvm::dbgs(), llvm::PredicatedScalarEvolution::getAsAddRec(), getCastsForInductionPHI(), llvm::PredicatedScalarEvolution::getSCEV(), llvm::PredicatedScalarEvolution::getSE(), llvm::Value::getType(), llvm::Type::isDoubleTy(), llvm::Type::isFloatingPointTy(), llvm::Type::isFloatTy(), isFPInductionPHI(), llvm::Type::isHalfTy(), isInductionPHI(), llvm::Type::isIntegerTy(), llvm::Type::isPointerTy(), and LLVM_DEBUG.

◆ isInductionPHI() [2/2]

bool InductionDescriptor::isInductionPHI ( PHINode Phi,
const Loop L,
ScalarEvolution SE,
InductionDescriptor D,
const SCEV Expr = nullptr,
SmallVectorImpl< Instruction * > *  CastsToIgnore = nullptr 
)
static

The documentation for this class was generated from the following files: