class RecurrenceDescriptor

Declaration

class RecurrenceDescriptor { /* full declaration omitted */ };

Description

This struct holds information about recurrence variables.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:62

Method Overview

  • public static bool AddReductionVar(llvm::PHINode * Phi, llvm::RecurrenceDescriptor::RecurrenceKind Kind, llvm::Loop * TheLoop, bool HasFunNoNaNAttr, llvm::RecurrenceDescriptor & RedDes, llvm::DemandedBits * DB = nullptr, llvm::AssumptionCache * AC = nullptr, llvm::DominatorTree * DT = nullptr)
  • public RecurrenceDescriptor(llvm::Value * Start, llvm::Instruction * Exit, llvm::RecurrenceDescriptor::RecurrenceKind K, llvm::FastMathFlags FMF, llvm::RecurrenceDescriptor::MinMaxRecurrenceKind MK, llvm::Instruction * UAI, llvm::Type * RT, bool Signed, SmallPtrSetImpl<llvm::Instruction *> & CI)
  • public RecurrenceDescriptor()
  • public static bool areAllUsesIn(llvm::Instruction * I, SmallPtrSetImpl<llvm::Instruction *> & Set)
  • public SmallPtrSet<llvm::Instruction *, 8> & getCastInsts()
  • public llvm::FastMathFlags getFastMathFlags()
  • public llvm::Instruction * getLoopExitInstr()
  • public llvm::RecurrenceDescriptor::MinMaxRecurrenceKind getMinMaxRecurrenceKind()
  • public static unsigned int getRecurrenceBinOp(llvm::RecurrenceDescriptor::RecurrenceKind Kind)
  • public static llvm::Constant * getRecurrenceIdentity(llvm::RecurrenceDescriptor::RecurrenceKind K, llvm::Type * Tp)
  • public llvm::RecurrenceDescriptor::RecurrenceKind getRecurrenceKind()
  • public TrackingVH<llvm::Value> getRecurrenceStartValue()
  • public llvm::Type * getRecurrenceType()
  • public llvm::Instruction * getUnsafeAlgebraInst()
  • public static bool hasMultipleUsesOf(llvm::Instruction * I, SmallPtrSetImpl<llvm::Instruction *> & Insts, unsigned int MaxNumUses)
  • public bool hasUnsafeAlgebra()
  • public static bool isArithmeticRecurrenceKind(llvm::RecurrenceDescriptor::RecurrenceKind Kind)
  • public static llvm::RecurrenceDescriptor::InstDesc isConditionalRdxPattern(llvm::RecurrenceDescriptor::RecurrenceKind Kind, llvm::Instruction * I)
  • public static bool isFirstOrderRecurrence(llvm::PHINode * Phi, llvm::Loop * TheLoop, DenseMap<llvm::Instruction *, llvm::Instruction *> & SinkAfter, llvm::DominatorTree * DT)
  • public static bool isFloatingPointRecurrenceKind(llvm::RecurrenceDescriptor::RecurrenceKind Kind)
  • public static bool isIntegerRecurrenceKind(llvm::RecurrenceDescriptor::RecurrenceKind Kind)
  • public static llvm::RecurrenceDescriptor::InstDesc isMinMaxSelectCmpPattern(llvm::Instruction * I, llvm::RecurrenceDescriptor::InstDesc & Prev)
  • public static llvm::RecurrenceDescriptor::InstDesc isRecurrenceInstr(llvm::Instruction * I, llvm::RecurrenceDescriptor::RecurrenceKind Kind, llvm::RecurrenceDescriptor::InstDesc & Prev, bool HasFunNoNaNAttr)
  • public static bool isReductionPHI(llvm::PHINode * Phi, llvm::Loop * TheLoop, llvm::RecurrenceDescriptor & RedDes, llvm::DemandedBits * DB = nullptr, llvm::AssumptionCache * AC = nullptr, llvm::DominatorTree * DT = nullptr)
  • public bool isSigned()

Methods

static bool AddReductionVar(
    llvm::PHINode* Phi,
    llvm::RecurrenceDescriptor::RecurrenceKind
        Kind,
    llvm::Loop* TheLoop,
    bool HasFunNoNaNAttr,
    llvm::RecurrenceDescriptor& RedDes,
    llvm::DemandedBits* DB = nullptr,
    llvm::AssumptionCache* AC = nullptr,
    llvm::DominatorTree* DT = nullptr)

Description

Returns true if Phi is a reduction of type Kind and adds it to the RecurrenceDescriptor. If either \p DB is non-null or \p AC and \p DT are non-null, the minimal bit width needed to compute the reduction will be computed.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:170

Parameters

llvm::PHINode* Phi
llvm::RecurrenceDescriptor::RecurrenceKind Kind
llvm::Loop* TheLoop
bool HasFunNoNaNAttr
llvm::RecurrenceDescriptor& RedDes
llvm::DemandedBits* DB = nullptr
llvm::AssumptionCache* AC = nullptr
llvm::DominatorTree* DT = nullptr

RecurrenceDescriptor(
    llvm::Value* Start,
    llvm::Instruction* Exit,
    llvm::RecurrenceDescriptor::RecurrenceKind K,
    llvm::FastMathFlags FMF,
    llvm::RecurrenceDescriptor::
        MinMaxRecurrenceKind MK,
    llvm::Instruction* UAI,
    llvm::Type* RT,
    bool Signed,
    SmallPtrSetImpl<llvm::Instruction*>& CI)

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:91

Parameters

llvm::Value* Start
llvm::Instruction* Exit
llvm::RecurrenceDescriptor::RecurrenceKind K
llvm::FastMathFlags FMF
llvm::RecurrenceDescriptor::MinMaxRecurrenceKind MK
llvm::Instruction* UAI
llvm::Type* RT
bool Signed
SmallPtrSetImpl<llvm::Instruction*>& CI

RecurrenceDescriptor()

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:89

static bool areAllUsesIn(
    llvm::Instruction* I,
    SmallPtrSetImpl<llvm::Instruction*>& Set)

Description

Returns true if all uses of the instruction I is within the Set.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:148

Parameters

llvm::Instruction* I
SmallPtrSetImpl<llvm::Instruction*>& Set

SmallPtrSet<llvm::Instruction*, 8>& getCastInsts()

Description

Returns a reference to the instructions used for type-promoting the recurrence.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:231

llvm::FastMathFlags getFastMathFlags()

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:203

llvm::Instruction* getLoopExitInstr()

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:207

llvm::RecurrenceDescriptor::MinMaxRecurrenceKind
getMinMaxRecurrenceKind()

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:201

static unsigned int getRecurrenceBinOp(
    llvm::RecurrenceDescriptor::RecurrenceKind
        Kind)

Description

Returns the opcode of binary operation corresponding to the RecurrenceKind.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:164

Parameters

llvm::RecurrenceDescriptor::RecurrenceKind Kind

static llvm::Constant* getRecurrenceIdentity(
    llvm::RecurrenceDescriptor::RecurrenceKind K,
    llvm::Type* Tp)

Description

Returns identity corresponding to the RecurrenceKind.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:160

Parameters

llvm::RecurrenceDescriptor::RecurrenceKind K
llvm::Type* Tp

llvm::RecurrenceDescriptor::RecurrenceKind
getRecurrenceKind()

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:199

TrackingVH<llvm::Value> getRecurrenceStartValue()

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:205

llvm::Type* getRecurrenceType()

Description

Returns the type of the recurrence. This type can be narrower than the actual type of the Phi if the recurrence has been type-promoted.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:227

llvm::Instruction* getUnsafeAlgebraInst()

Description

Returns first unsafe algebra instruction in the PHI node's use-chain.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:214

static bool hasMultipleUsesOf(
    llvm::Instruction* I,
    SmallPtrSetImpl<llvm::Instruction*>& Insts,
    unsigned int MaxNumUses)

Description

Returns true if instruction I has multiple uses in Insts

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:143

Parameters

llvm::Instruction* I
SmallPtrSetImpl<llvm::Instruction*>& Insts
unsigned int MaxNumUses

bool hasUnsafeAlgebra()

Description

Returns true if the recurrence has unsafe algebra which requires a relaxed floating-point model.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:211

static bool isArithmeticRecurrenceKind(
    llvm::RecurrenceDescriptor::RecurrenceKind
        Kind)

Description

Returns true if the recurrence kind is an arithmetic kind.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:223

Parameters

llvm::RecurrenceDescriptor::RecurrenceKind Kind

static llvm::RecurrenceDescriptor::InstDesc
isConditionalRdxPattern(
    llvm::RecurrenceDescriptor::RecurrenceKind
        Kind,
    llvm::Instruction* I)

Description

Returns a struct describing if the instruction is a Select(FCmp(X, Y), (Z = X op PHINode), PHINode) instruction pattern.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:157

Parameters

llvm::RecurrenceDescriptor::RecurrenceKind Kind
llvm::Instruction* I

static bool isFirstOrderRecurrence(
    llvm::PHINode* Phi,
    llvm::Loop* TheLoop,
    DenseMap<llvm::Instruction*,
             llvm::Instruction*>& SinkAfter,
    llvm::DominatorTree* DT)

Description

Returns true if Phi is a first-order recurrence. A first-order recurrence is a non-reduction recurrence relation in which the value of the recurrence in the current loop iteration equals a value defined in the previous iteration. \p SinkAfter includes pairs of instructions where the first will be rescheduled to appear after the second if/when the loop is vectorized. It may be augmented with additional pairs if needed in order to handle Phi as a first-order recurrence.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:195

Parameters

llvm::PHINode* Phi
llvm::Loop* TheLoop
DenseMap<llvm::Instruction*, llvm::Instruction*>& SinkAfter
llvm::DominatorTree* DT

static bool isFloatingPointRecurrenceKind(
    llvm::RecurrenceDescriptor::RecurrenceKind
        Kind)

Description

Returns true if the recurrence kind is a floating point kind.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:220

Parameters

llvm::RecurrenceDescriptor::RecurrenceKind Kind

static bool isIntegerRecurrenceKind(
    llvm::RecurrenceDescriptor::RecurrenceKind
        Kind)

Description

Returns true if the recurrence kind is an integer kind.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:217

Parameters

llvm::RecurrenceDescriptor::RecurrenceKind Kind

static llvm::RecurrenceDescriptor::InstDesc
isMinMaxSelectCmpPattern(
    llvm::Instruction* I,
    llvm::RecurrenceDescriptor::InstDesc& Prev)

Description

Returns a struct describing if the instruction if the instruction is a Select(ICmp(X, Y), X, Y) instruction pattern corresponding to a min(X, Y) or max(X, Y).

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:153

Parameters

llvm::Instruction* I
llvm::RecurrenceDescriptor::InstDesc& Prev

static llvm::RecurrenceDescriptor::InstDesc
isRecurrenceInstr(
    llvm::Instruction* I,
    llvm::RecurrenceDescriptor::RecurrenceKind
        Kind,
    llvm::RecurrenceDescriptor::InstDesc& Prev,
    bool HasFunNoNaNAttr)

Description

Returns a struct describing if the instruction 'I' can be a recurrence variable of type 'Kind'. If the recurrence is a min/max pattern of select(icmp()) this function advances the instruction pointer 'I' from the compare instruction to the select instruction and stores this pointer in 'PatternLastInst' member of the returned struct.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:139

Parameters

llvm::Instruction* I
llvm::RecurrenceDescriptor::RecurrenceKind Kind
llvm::RecurrenceDescriptor::InstDesc& Prev
bool HasFunNoNaNAttr

static bool isReductionPHI(
    llvm::PHINode* Phi,
    llvm::Loop* TheLoop,
    llvm::RecurrenceDescriptor& RedDes,
    llvm::DemandedBits* DB = nullptr,
    llvm::AssumptionCache* AC = nullptr,
    llvm::DominatorTree* DT = nullptr)

Description

Returns true if Phi is a reduction in TheLoop. The RecurrenceDescriptor is returned in RedDes. If either \p DB is non-null or \p AC and \p DT are non-null, the minimal bit width needed to compute the reduction will be computed.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:181

Parameters

llvm::PHINode* Phi
llvm::Loop* TheLoop
llvm::RecurrenceDescriptor& RedDes
llvm::DemandedBits* DB = nullptr
llvm::AssumptionCache* AC = nullptr
llvm::DominatorTree* DT = nullptr

bool isSigned()

Description

Returns true if all source operands of the recurrence are SExtInsts.

Declared at: llvm/include/llvm/Analysis/IVDescriptors.h:234