class DependenceInfo

Declaration

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

Description

DependenceInfo - This class is the main dependence-analysis driver.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:269

Member Variables

private llvm::AAResults* AA
private llvm::ScalarEvolution* SE
private llvm::LoopInfo* LI
private llvm::Function* F
private unsigned int CommonLevels
private unsigned int SrcLevels
private unsigned int MaxLevels

Method Overview

  • public DependenceInfo(llvm::Function * F, llvm::AAResults * AA, llvm::ScalarEvolution * SE, llvm::LoopInfo * LI)
  • private const llvm::SCEV * addToCoefficient(const llvm::SCEV * Expr, const llvm::Loop * TargetLoop, const llvm::SCEV * Value) const
  • private bool banerjeeMIVtest(const llvm::SCEV * Src, const llvm::SCEV * Dst, const llvm::SmallBitVector & Loops, llvm::FullDependence & Result) const
  • private bool checkDstSubscript(const llvm::SCEV * Dst, const llvm::Loop * LoopNest, llvm::SmallBitVector & Loops)
  • private bool checkSrcSubscript(const llvm::SCEV * Src, const llvm::Loop * LoopNest, llvm::SmallBitVector & Loops)
  • private bool checkSubscript(const llvm::SCEV * Expr, const llvm::Loop * LoopNest, llvm::SmallBitVector & Loops, bool IsSrc)
  • private Subscript::ClassificationKind classifyPair(const llvm::SCEV * Src, const llvm::Loop * SrcLoopNest, const llvm::SCEV * Dst, const llvm::Loop * DstLoopNest, llvm::SmallBitVector & Loops)
  • private llvm::DependenceInfo::CoefficientInfo * collectCoeffInfo(const llvm::SCEV * Subscript, bool SrcFlag, const llvm::SCEV *& Constant) const
  • private void collectCommonLoops(const llvm::SCEV * Expression, const llvm::Loop * LoopNest, llvm::SmallBitVector & Loops) const
  • private const llvm::SCEVConstant * collectConstantUpperBound(const llvm::Loop * l, llvm::Type * T) const
  • private const llvm::SCEV * collectUpperBound(const llvm::Loop * l, llvm::Type * T) const
  • public std::unique_ptr<Dependence> depends(llvm::Instruction * Src, llvm::Instruction * Dst, bool PossiblyLoopIndependent)
  • private void establishNestingLevels(const llvm::Instruction * Src, const llvm::Instruction * Dst)
  • private bool exactRDIVtest(const llvm::SCEV * SrcCoeff, const llvm::SCEV * DstCoeff, const llvm::SCEV * SrcConst, const llvm::SCEV * DstConst, const llvm::Loop * SrcLoop, const llvm::Loop * DstLoop, llvm::FullDependence & Result) const
  • private bool exactSIVtest(const llvm::SCEV * SrcCoeff, const llvm::SCEV * DstCoeff, const llvm::SCEV * SrcConst, const llvm::SCEV * DstConst, const llvm::Loop * CurrentLoop, unsigned int Level, llvm::FullDependence & Result, llvm::DependenceInfo::Constraint & NewConstraint) const
  • private unsigned int exploreDirections(unsigned int Level, llvm::DependenceInfo::CoefficientInfo * A, llvm::DependenceInfo::CoefficientInfo * B, llvm::DependenceInfo::BoundInfo * Bound, const llvm::SmallBitVector & Loops, unsigned int & DepthExpanded, const llvm::SCEV * Delta) const
  • private void findBoundsALL(llvm::DependenceInfo::CoefficientInfo * A, llvm::DependenceInfo::CoefficientInfo * B, llvm::DependenceInfo::BoundInfo * Bound, unsigned int K) const
  • private void findBoundsEQ(llvm::DependenceInfo::CoefficientInfo * A, llvm::DependenceInfo::CoefficientInfo * B, llvm::DependenceInfo::BoundInfo * Bound, unsigned int K) const
  • private void findBoundsGT(llvm::DependenceInfo::CoefficientInfo * A, llvm::DependenceInfo::CoefficientInfo * B, llvm::DependenceInfo::BoundInfo * Bound, unsigned int K) const
  • private void findBoundsLT(llvm::DependenceInfo::CoefficientInfo * A, llvm::DependenceInfo::CoefficientInfo * B, llvm::DependenceInfo::BoundInfo * Bound, unsigned int K) const
  • private const llvm::SCEV * findCoefficient(const llvm::SCEV * Expr, const llvm::Loop * TargetLoop) const
  • private bool gcdMIVtest(const llvm::SCEV * Src, const llvm::SCEV * Dst, llvm::FullDependence & Result) const
  • public llvm::Function * getFunction() const
  • private const llvm::SCEV * getLowerBound(llvm::DependenceInfo::BoundInfo * Bound) const
  • private const llvm::SCEV * getNegativePart(const llvm::SCEV * X) const
  • private const llvm::SCEV * getPositivePart(const llvm::SCEV * X) const
  • public const llvm::SCEV * getSplitIteration(const llvm::Dependence & Dep, unsigned int Level)
  • private const llvm::SCEV * getUpperBound(llvm::DependenceInfo::BoundInfo * Bound) const
  • private bool intersectConstraints(llvm::DependenceInfo::Constraint * X, const llvm::DependenceInfo::Constraint * Y)
  • public bool invalidate(llvm::Function & F, const llvm::PreservedAnalyses & PA, FunctionAnalysisManager::Invalidator & Inv)
  • private bool isKnownLessThan(const llvm::SCEV * S, const llvm::SCEV * Size) const
  • private bool isKnownNonNegative(const llvm::SCEV * S, const llvm::Value * Ptr) const
  • private bool isKnownPredicate(ICmpInst::Predicate Pred, const llvm::SCEV * X, const llvm::SCEV * Y) const
  • private bool isLoopInvariant(const llvm::SCEV * Expression, const llvm::Loop * LoopNest) const
  • private unsigned int mapDstLoop(const llvm::Loop * DstLoop) const
  • private unsigned int mapSrcLoop(const llvm::Loop * SrcLoop) const
  • private bool propagate(const llvm::SCEV *& Src, const llvm::SCEV *& Dst, llvm::SmallBitVector & Loops, SmallVectorImpl<llvm::DependenceInfo::Constraint> & Constraints, bool & Consistent)
  • private bool propagateDistance(const llvm::SCEV *& Src, const llvm::SCEV *& Dst, llvm::DependenceInfo::Constraint & CurConstraint, bool & Consistent)
  • private bool propagateLine(const llvm::SCEV *& Src, const llvm::SCEV *& Dst, llvm::DependenceInfo::Constraint & CurConstraint, bool & Consistent)
  • private bool propagatePoint(const llvm::SCEV *& Src, const llvm::SCEV *& Dst, llvm::DependenceInfo::Constraint & CurConstraint)
  • private void removeMatchingExtensions(llvm::DependenceInfo::Subscript * Pair)
  • private bool strongSIVtest(const llvm::SCEV * Coeff, const llvm::SCEV * SrcConst, const llvm::SCEV * DstConst, const llvm::Loop * CurrentLoop, unsigned int Level, llvm::FullDependence & Result, llvm::DependenceInfo::Constraint & NewConstraint) const
  • private bool symbolicRDIVtest(const llvm::SCEV * SrcCoeff, const llvm::SCEV * DstCoeff, const llvm::SCEV * SrcConst, const llvm::SCEV * DstConst, const llvm::Loop * SrcLoop, const llvm::Loop * DstLoop) const
  • private bool testBounds(unsigned char DirKind, unsigned int Level, llvm::DependenceInfo::BoundInfo * Bound, const llvm::SCEV * Delta) const
  • private bool testMIV(const llvm::SCEV * Src, const llvm::SCEV * Dst, const llvm::SmallBitVector & Loops, llvm::FullDependence & Result) const
  • private bool testRDIV(const llvm::SCEV * Src, const llvm::SCEV * Dst, llvm::FullDependence & Result) const
  • private bool testSIV(const llvm::SCEV * Src, const llvm::SCEV * Dst, unsigned int & Level, llvm::FullDependence & Result, llvm::DependenceInfo::Constraint & NewConstraint, const llvm::SCEV *& SplitIter) const
  • private bool testZIV(const llvm::SCEV * Src, const llvm::SCEV * Dst, llvm::FullDependence & Result) const
  • private bool tryDelinearize(llvm::Instruction * Src, llvm::Instruction * Dst, SmallVectorImpl<llvm::DependenceInfo::Subscript> & Pair)
  • private bool tryDelinearizeFixedSize(llvm::Instruction * Src, llvm::Instruction * Dst, const llvm::SCEV * SrcAccessFn, const llvm::SCEV * DstAccessFn, SmallVectorImpl<const llvm::SCEV *> & SrcSubscripts, SmallVectorImpl<const llvm::SCEV *> & DstSubscripts)
  • private bool tryDelinearizeParametricSize(llvm::Instruction * Src, llvm::Instruction * Dst, const llvm::SCEV * SrcAccessFn, const llvm::SCEV * DstAccessFn, SmallVectorImpl<const llvm::SCEV *> & SrcSubscripts, SmallVectorImpl<const llvm::SCEV *> & DstSubscripts)
  • private void unifySubscriptType(ArrayRef<llvm::DependenceInfo::Subscript *> Pairs)
  • private void updateDirection(Dependence::DVEntry & Level, const llvm::DependenceInfo::Constraint & CurConstraint) const
  • private bool weakCrossingSIVtest(const llvm::SCEV * SrcCoeff, const llvm::SCEV * SrcConst, const llvm::SCEV * DstConst, const llvm::Loop * CurrentLoop, unsigned int Level, llvm::FullDependence & Result, llvm::DependenceInfo::Constraint & NewConstraint, const llvm::SCEV *& SplitIter) const
  • private bool weakZeroDstSIVtest(const llvm::SCEV * SrcCoeff, const llvm::SCEV * SrcConst, const llvm::SCEV * DstConst, const llvm::Loop * CurrentLoop, unsigned int Level, llvm::FullDependence & Result, llvm::DependenceInfo::Constraint & NewConstraint) const
  • private bool weakZeroSrcSIVtest(const llvm::SCEV * DstCoeff, const llvm::SCEV * SrcConst, const llvm::SCEV * DstConst, const llvm::Loop * CurrentLoop, unsigned int Level, llvm::FullDependence & Result, llvm::DependenceInfo::Constraint & NewConstraint) const
  • private const llvm::SCEV * zeroCoefficient(const llvm::SCEV * Expr, const llvm::Loop * TargetLoop) const

Methods

DependenceInfo(llvm::Function* F,
               llvm::AAResults* AA,
               llvm::ScalarEvolution* SE,
               llvm::LoopInfo* LI)

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:271

Parameters

llvm::Function* F
llvm::AAResults* AA
llvm::ScalarEvolution* SE
llvm::LoopInfo* LI

const llvm::SCEV* addToCoefficient(
    const llvm::SCEV* Expr,
    const llvm::Loop* TargetLoop,
    const llvm::SCEV* Value) const

Description

addToCoefficient - Given a linear SCEV Expr, return the SCEV given by adding some Value to the coefficient corresponding to the specified TargetLoop. For example, given a*i + b*j + c*k, adding 1 to the coefficient corresponding to the j loop would yield a*i + (b+1)*j + c*k.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:916

Parameters

const llvm::SCEV* Expr
const llvm::Loop* TargetLoop
const llvm::SCEV* Value

bool banerjeeMIVtest(
    const llvm::SCEV* Src,
    const llvm::SCEV* Dst,
    const llvm::SmallBitVector& Loops,
    llvm::FullDependence& Result) const

Description

banerjeeMIVtest - Tests an MIV subscript pair for dependence. Returns true if any possible dependence is disproved. Marks the result as inconsistent. Computes directions.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:775

Parameters

const llvm::SCEV* Src
const llvm::SCEV* Dst
const llvm::SmallBitVector& Loops
llvm::FullDependence& Result

bool checkDstSubscript(
    const llvm::SCEV* Dst,
    const llvm::Loop* LoopNest,
    llvm::SmallBitVector& Loops)

Description

checkDstSubscript - Examines the SCEV Dst, returning true iff it's linear. Collect the set of loops mentioned by Dst.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:549

Parameters

const llvm::SCEV* Dst
const llvm::Loop* LoopNest
llvm::SmallBitVector& Loops

bool checkSrcSubscript(
    const llvm::SCEV* Src,
    const llvm::Loop* LoopNest,
    llvm::SmallBitVector& Loops)

Description

checkSrcSubscript - Examines the SCEV Src, returning true iff it's linear. Collect the set of loops mentioned by Src.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:543

Parameters

const llvm::SCEV* Src
const llvm::Loop* LoopNest
llvm::SmallBitVector& Loops

bool checkSubscript(const llvm::SCEV* Expr,
                    const llvm::Loop* LoopNest,
                    llvm::SmallBitVector& Loops,
                    bool IsSrc)

Description

checkSubscript - Helper function for checkSrcSubscript and checkDstSubscript to avoid duplicate code

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:949

Parameters

const llvm::SCEV* Expr
const llvm::Loop* LoopNest
llvm::SmallBitVector& Loops
bool IsSrc

Subscript::ClassificationKind classifyPair(
    const llvm::SCEV* Src,
    const llvm::Loop* SrcLoopNest,
    const llvm::SCEV* Dst,
    const llvm::Loop* DstLoopNest,
    llvm::SmallBitVector& Loops)

Description

classifyPair - Examines the subscript pair (the Src and Dst SCEVs) and classifies it as either ZIV, SIV, RDIV, MIV, or Nonlinear. Collects the associated loops in a set.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:587

Parameters

const llvm::SCEV* Src
const llvm::Loop* SrcLoopNest
const llvm::SCEV* Dst
const llvm::Loop* DstLoopNest
llvm::SmallBitVector& Loops

llvm::DependenceInfo::CoefficientInfo*
collectCoeffInfo(
    const llvm::SCEV* Subscript,
    bool SrcFlag,
    const llvm::SCEV*& Constant) const

Description

collectCoefficientInfo - Walks through the subscript, collecting each coefficient, the associated loop bounds, and recording its positive and negative parts for later use.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:783

Parameters

const llvm::SCEV* Subscript
bool SrcFlag
const llvm::SCEV*& Constant

void collectCommonLoops(
    const llvm::SCEV* Expression,
    const llvm::Loop* LoopNest,
    llvm::SmallBitVector& Loops) const

Description

collectCommonLoops - Finds the set of loops from the LoopNest that have a level < = CommonLevels and are referred to by the SCEV Expression.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:537

Parameters

const llvm::SCEV* Expression
const llvm::Loop* LoopNest
llvm::SmallBitVector& Loops

const llvm::SCEVConstant*
collectConstantUpperBound(const llvm::Loop* l,
                          llvm::Type* T) const

Description

collectConstantUpperBound - Calls collectUpperBound(), then attempts to cast it to SCEVConstant. If the cast fails, returns NULL.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:582

Parameters

const llvm::Loop* l
llvm::Type* T

const llvm::SCEV* collectUpperBound(
    const llvm::Loop* l,
    llvm::Type* T) const

Description

collectUpperBound - All subscripts are the same type (on my machine, an i64). The loop bound may be a smaller type. collectUpperBound find the bound, if available, and zero extends it to the Type T. (I zero extend since the bound should always be >= 0.) If no upper bound is available, return NULL.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:577

Parameters

const llvm::Loop* l
llvm::Type* T

std::unique_ptr<Dependence> depends(
    llvm::Instruction* Src,
    llvm::Instruction* Dst,
    bool PossiblyLoopIndependent)

Description

depends - Tests for a dependence between the Src and Dst instructions. Returns NULL if no dependence; otherwise, returns a Dependence (or a FullDependence) with as much information as can be gleaned. The flag PossiblyLoopIndependent should be set by the caller if it appears that control flow can reach from Src to Dst without traversing a loop back edge.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:285

Parameters

llvm::Instruction* Src
llvm::Instruction* Dst
bool PossiblyLoopIndependent

void establishNestingLevels(
    const llvm::Instruction* Src,
    const llvm::Instruction* Dst)

Description

establishNestingLevels - Examines the loop nesting of the Src and Dst instructions and establishes their shared loops. Sets the variables CommonLevels, SrcLevels, and MaxLevels. The source and destination instructions needn't be contained in the same loop. The routine establishNestingLevels finds the level of most deeply nested loop that contains them both, CommonLevels. An instruction that's not contained in a loop is at level = 0. MaxLevels is equal to the level of the source plus the level of the destination, minus CommonLevels. This lets us allocate vectors MaxLevels in length, with room for every distinct loop referenced in both the source and destination subscripts. The variable SrcLevels is the nesting depth of the source instruction. It's used to help calculate distinct loops referenced by the destination. Here's the map from loops to levels: 0 - unused 1 - outermost common loop ... - other common loops CommonLevels - innermost common loop ... - loops containing Src but not Dst SrcLevels - innermost loop containing Src but not Dst ... - loops containing Dst but not Src MaxLevels - innermost loop containing Dst but not Src Consider the follow code fragment: for (a = ...) { for (b = ...) { for (c = ...) { for (d = ...) { A[] = ...; } } for (e = ...) { for (f = ...) { for (g = ...) { ... = A[]; } } } } } If we're looking at the possibility of a dependence between the store to A (the Src) and the load from A (the Dst), we'll note that they have 2 loops in common, so CommonLevels will equal 2 and the direction vector for Result will have 2 entries. SrcLevels = 4 and MaxLevels = 7. A map from loop names to level indices would look like a - 1 b - 2 = CommonLevels c - 3 d - 4 = SrcLevels e - 5 f - 6 g - 7 = MaxLevels

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:506

Parameters

const llvm::Instruction* Src
const llvm::Instruction* Dst

bool exactRDIVtest(
    const llvm::SCEV* SrcCoeff,
    const llvm::SCEV* DstCoeff,
    const llvm::SCEV* SrcConst,
    const llvm::SCEV* DstConst,
    const llvm::Loop* SrcLoop,
    const llvm::Loop* DstLoop,
    llvm::FullDependence& Result) const

Description

exactRDIVtest - Tests the RDIV subscript pair for dependence. Things of the form [c1 + a*i] and [c2 + b*j], where i and j are induction variable, c1 and c2 are loop invariant, and a and b are constants. Returns true if any possible dependence is disproved. Marks the result as inconsistent. Works in some cases that symbolicRDIVtest doesn't, and vice versa.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:737

Parameters

const llvm::SCEV* SrcCoeff
const llvm::SCEV* DstCoeff
const llvm::SCEV* SrcConst
const llvm::SCEV* DstConst
const llvm::Loop* SrcLoop
const llvm::Loop* DstLoop
llvm::FullDependence& Result

bool exactSIVtest(
    const llvm::SCEV* SrcCoeff,
    const llvm::SCEV* DstCoeff,
    const llvm::SCEV* SrcConst,
    const llvm::SCEV* DstConst,
    const llvm::Loop* CurrentLoop,
    unsigned int Level,
    llvm::FullDependence& Result,
    llvm::DependenceInfo::Constraint&
        NewConstraint) const

Description

ExactSIVtest - Tests the SIV subscript pair (Src and Dst) for dependence. Things of the form [c1 + a1*i] and [c2 + a2*i], where i is an induction variable, c1 and c2 are loop invariant, and a1 and a2 are constant. Returns true if any possible dependence is disproved. If there might be a dependence, returns false. Sets appropriate direction entry. Set consistent to false.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:684

Parameters

const llvm::SCEV* SrcCoeff
const llvm::SCEV* DstCoeff
const llvm::SCEV* SrcConst
const llvm::SCEV* DstConst
const llvm::Loop* CurrentLoop
unsigned int Level
llvm::FullDependence& Result
llvm::DependenceInfo::Constraint& NewConstraint

unsigned int exploreDirections(
    unsigned int Level,
    llvm::DependenceInfo::CoefficientInfo* A,
    llvm::DependenceInfo::CoefficientInfo* B,
    llvm::DependenceInfo::BoundInfo* Bound,
    const llvm::SmallBitVector& Loops,
    unsigned int& DepthExpanded,
    const llvm::SCEV* Delta) const

Description

exploreDirections - Hierarchically expands the direction vector search space, combining the directions of discovered dependences in the DirSet field of Bound. Returns the number of distinct dependences discovered. If the dependence is disproved, it will return 0.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:810

Parameters

unsigned int Level
llvm::DependenceInfo::CoefficientInfo* A
llvm::DependenceInfo::CoefficientInfo* B
llvm::DependenceInfo::BoundInfo* Bound
const llvm::SmallBitVector& Loops
unsigned int& DepthExpanded
const llvm::SCEV* Delta

void findBoundsALL(
    llvm::DependenceInfo::CoefficientInfo* A,
    llvm::DependenceInfo::CoefficientInfo* B,
    llvm::DependenceInfo::BoundInfo* Bound,
    unsigned int K) const

Description

findBoundsALL - Computes the upper and lower bounds for level K using the * direction. Records them in Bound.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:826

Parameters

llvm::DependenceInfo::CoefficientInfo* A
llvm::DependenceInfo::CoefficientInfo* B
llvm::DependenceInfo::BoundInfo* Bound
unsigned int K

void findBoundsEQ(
    llvm::DependenceInfo::CoefficientInfo* A,
    llvm::DependenceInfo::CoefficientInfo* B,
    llvm::DependenceInfo::BoundInfo* Bound,
    unsigned int K) const

Description

findBoundsEQ - Computes the upper and lower bounds for level K using the = direction. Records them in Bound.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:847

Parameters

llvm::DependenceInfo::CoefficientInfo* A
llvm::DependenceInfo::CoefficientInfo* B
llvm::DependenceInfo::BoundInfo* Bound
unsigned int K

void findBoundsGT(
    llvm::DependenceInfo::CoefficientInfo* A,
    llvm::DependenceInfo::CoefficientInfo* B,
    llvm::DependenceInfo::BoundInfo* Bound,
    unsigned int K) const

Description

findBoundsGT - Computes the upper and lower bounds for level K using the > direction. Records them in Bound.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:840

Parameters

llvm::DependenceInfo::CoefficientInfo* A
llvm::DependenceInfo::CoefficientInfo* B
llvm::DependenceInfo::BoundInfo* Bound
unsigned int K

void findBoundsLT(
    llvm::DependenceInfo::CoefficientInfo* A,
    llvm::DependenceInfo::CoefficientInfo* B,
    llvm::DependenceInfo::BoundInfo* Bound,
    unsigned int K) const

Description

findBoundsLT - Computes the upper and lower bounds for level K using the < direction. Records them in Bound.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:833

Parameters

llvm::DependenceInfo::CoefficientInfo* A
llvm::DependenceInfo::CoefficientInfo* B
llvm::DependenceInfo::BoundInfo* Bound
unsigned int K

const llvm::SCEV* findCoefficient(
    const llvm::SCEV* Expr,
    const llvm::Loop* TargetLoop) const

Description

findCoefficient - Given a linear SCEV, return the coefficient corresponding to specified loop. If there isn't one, return the SCEV constant 0. For example, given a*i + b*j + c*k, returning the coefficient corresponding to the j loop would yield b.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:900

Parameters

const llvm::SCEV* Expr
const llvm::Loop* TargetLoop

bool gcdMIVtest(
    const llvm::SCEV* Src,
    const llvm::SCEV* Dst,
    llvm::FullDependence& Result) const

Description

so we use it as a backup for everything.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:767

Parameters

const llvm::SCEV* Src
const llvm::SCEV* Dst
llvm::FullDependence& Result

llvm::Function* getFunction() const

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:331

const llvm::SCEV* getLowerBound(
    llvm::DependenceInfo::BoundInfo* Bound) const

Description

getLowerBound - Looks through all the bounds info and computes the lower bound given the current direction settings at each level.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:798

Parameters

llvm::DependenceInfo::BoundInfo* Bound

const llvm::SCEV* getNegativePart(
    const llvm::SCEV* X) const

Description

getNegativePart - X^- = min(X, 0).

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:793

Parameters

const llvm::SCEV* X

const llvm::SCEV* getPositivePart(
    const llvm::SCEV* X) const

Description

getPositivePart - X^+ = max(X, 0).

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:789

Parameters

const llvm::SCEV* X

const llvm::SCEV* getSplitIteration(
    const llvm::Dependence& Dep,
    unsigned int Level)

Description

getSplitIteration - Give a dependence that's splittable at some particular level, return the iteration that should be used to split the loop. Generally, the dependence analyzer will be used to build a dependence graph for a function (basically a map from instructions to dependences). Looking for cycles in the graph shows us loops that cannot be trivially vectorized/parallelized. We can try to improve the situation by examining all the dependences that make up the cycle, looking for ones we can break. Sometimes, peeling the first or last iteration of a loop will break dependences, and there are flags for those possibilities. Sometimes, splitting a loop at some other iteration will do the trick, and we've got a flag for that case. Rather than waste the space to record the exact iteration (since we rarely know), we provide a method that calculates the iteration. It's a drag that it must work from scratch, but wonderful in that it's possible. Here's an example: for (i = 0; i < 10; i++) A[i] = ... ... = A[11 - i] There's a loop-carried flow dependence from the store to the load, found by the weak-crossing SIV test. The dependence will have a flag, indicating that the dependence can be broken by splitting the loop. Calling getSplitIteration will return 5. Splitting the loop breaks the dependence, like so: for (i = 0; i < = 5; i++) A[i] = ... ... = A[11 - i] for (i = 6; i < 10; i++) A[i] = ... ... = A[11 - i] breaks the dependence and allows us to vectorize/parallelize both loops.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:329

Parameters

const llvm::Dependence& Dep
unsigned int Level

const llvm::SCEV* getUpperBound(
    llvm::DependenceInfo::BoundInfo* Bound) const

Description

getUpperBound - Looks through all the bounds info and computes the upper bound given the current direction settings at each level.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:803

Parameters

llvm::DependenceInfo::BoundInfo* Bound

bool intersectConstraints(
    llvm::DependenceInfo::Constraint* X,
    const llvm::DependenceInfo::Constraint* Y)

Description

intersectConstraints - Updates X with the intersection of the Constraints X and Y. Returns true if X has changed.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:854

Parameters

llvm::DependenceInfo::Constraint* X
const llvm::DependenceInfo::Constraint* Y

bool invalidate(
    llvm::Function& F,
    const llvm::PreservedAnalyses& PA,
    FunctionAnalysisManager::Invalidator& Inv)

Description

Handle transitive invalidation when the cached analysis results go away.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:276

Parameters

llvm::Function& F
const llvm::PreservedAnalyses& PA
FunctionAnalysisManager::Invalidator& Inv

bool isKnownLessThan(const llvm::SCEV* S,
                     const llvm::SCEV* Size) const

Description

isKnownLessThan - Compare to see if S is less than Size Another wrapper for isKnownNegative(S - max(Size, 1)) with some extra checking if S is an AddRec and we can prove lessthan using the loop bounds.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:565

Parameters

const llvm::SCEV* S
const llvm::SCEV* Size

bool isKnownNonNegative(
    const llvm::SCEV* S,
    const llvm::Value* Ptr) const

Description

isKnownNonNegative - Compare to see if S is known not to be negative Uses the fact that S comes from Ptr, which may be an inbound GEP, Proving there is no wrapping going on.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:570

Parameters

const llvm::SCEV* S
const llvm::Value* Ptr

bool isKnownPredicate(ICmpInst::Predicate Pred,
                      const llvm::SCEV* X,
                      const llvm::SCEV* Y) const

Description

isKnownPredicate - Compare X and Y using the predicate Pred. Basically a wrapper for SCEV::isKnownPredicate, but tries harder, especially in the presence of sign and zero extensions and symbolics.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:557

Parameters

ICmpInst::Predicate Pred
const llvm::SCEV* X
const llvm::SCEV* Y

bool isLoopInvariant(
    const llvm::SCEV* Expression,
    const llvm::Loop* LoopNest) const

Description

isLoopInvariant - Returns true if Expression is loop invariant in LoopNest.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:521

Parameters

const llvm::SCEV* Expression
const llvm::Loop* LoopNest

unsigned int mapDstLoop(
    const llvm::Loop* DstLoop) const

Description

mapDstLoop - Given one of the loops containing the destination, return its level index in our numbering scheme.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:517

Parameters

const llvm::Loop* DstLoop

unsigned int mapSrcLoop(
    const llvm::Loop* SrcLoop) const

Description

mapSrcLoop - Given one of the loops containing the source, return its level index in our numbering scheme.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:513

Parameters

const llvm::Loop* SrcLoop

bool propagate(
    const llvm::SCEV*& Src,
    const llvm::SCEV*& Dst,
    llvm::SmallBitVector& Loops,
    SmallVectorImpl<
        llvm::DependenceInfo::Constraint>&
        Constraints,
    bool& Consistent)

Description

propagate - Review the constraints, looking for opportunities to simplify a subscript pair (Src and Dst). Return true if some simplification occurs. If the simplification isn't exact (that is, if it is conservative in terms of dependence), set consistent to false.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:862

Parameters

const llvm::SCEV*& Src
const llvm::SCEV*& Dst
llvm::SmallBitVector& Loops
SmallVectorImpl<llvm::DependenceInfo::Constraint>& Constraints
bool& Consistent

bool propagateDistance(
    const llvm::SCEV*& Src,
    const llvm::SCEV*& Dst,
    llvm::DependenceInfo::Constraint&
        CurConstraint,
    bool& Consistent)

Description

propagateDistance - Attempt to propagate a distance constraint into a subscript pair (Src and Dst). Return true if some simplification occurs. If the simplification isn't exact (that is, if it is conservative in terms of dependence), set consistent to false.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:873

Parameters

const llvm::SCEV*& Src
const llvm::SCEV*& Dst
llvm::DependenceInfo::Constraint& CurConstraint
bool& Consistent

bool propagateLine(
    const llvm::SCEV*& Src,
    const llvm::SCEV*& Dst,
    llvm::DependenceInfo::Constraint&
        CurConstraint,
    bool& Consistent)

Description

propagateLine - Attempt to propagate a line constraint into a subscript pair (Src and Dst). Return true if some simplification occurs. If the simplification isn't exact (that is, if it is conservative in terms of dependence), set consistent to false.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:890

Parameters

const llvm::SCEV*& Src
const llvm::SCEV*& Dst
llvm::DependenceInfo::Constraint& CurConstraint
bool& Consistent

bool propagatePoint(
    const llvm::SCEV*& Src,
    const llvm::SCEV*& Dst,
    llvm::DependenceInfo::Constraint&
        CurConstraint)

Description

propagatePoint - Attempt to propagate a point constraint into a subscript pair (Src and Dst). Return true if some simplification occurs.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:881

Parameters

const llvm::SCEV*& Src
const llvm::SCEV*& Dst
llvm::DependenceInfo::Constraint& CurConstraint

void removeMatchingExtensions(
    llvm::DependenceInfo::Subscript* Pair)

Description

removeMatchingExtensions - Examines a subscript pair. If the source and destination are identically sign (or zero) extended, it strips off the extension in an effort to simplify the actual analysis.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:533

Parameters

llvm::DependenceInfo::Subscript* Pair

bool strongSIVtest(
    const llvm::SCEV* Coeff,
    const llvm::SCEV* SrcConst,
    const llvm::SCEV* DstConst,
    const llvm::Loop* CurrentLoop,
    unsigned int Level,
    llvm::FullDependence& Result,
    llvm::DependenceInfo::Constraint&
        NewConstraint) const

Description

strongSIVtest - Tests the strong SIV subscript pair (Src and Dst) for dependence. Things of the form [c1 + a*i] and [c2 + a*i], where i is an induction variable, c1 and c2 are loop invariant, and a is a constant Returns true if any possible dependence is disproved. If there might be a dependence, returns false. Sets appropriate direction and distance.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:648

Parameters

const llvm::SCEV* Coeff
const llvm::SCEV* SrcConst
const llvm::SCEV* DstConst
const llvm::Loop* CurrentLoop
unsigned int Level
llvm::FullDependence& Result
llvm::DependenceInfo::Constraint& NewConstraint

bool symbolicRDIVtest(
    const llvm::SCEV* SrcCoeff,
    const llvm::SCEV* DstCoeff,
    const llvm::SCEV* SrcConst,
    const llvm::SCEV* DstConst,
    const llvm::Loop* SrcLoop,
    const llvm::Loop* DstLoop) const

Description

symbolicRDIVtest - Tests the RDIV subscript pair for dependence. Things of the form [c1 + a*i] and [c2 + b*j], where i and j are induction variable, c1 and c2 are loop invariant, and a and b are constants. Returns true if any possible dependence is disproved. Marks the result as inconsistent. Works in some cases that exactRDIVtest doesn't, and vice versa. Can also be used as a backup for ordinary SIV tests.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:754

Parameters

const llvm::SCEV* SrcCoeff
const llvm::SCEV* DstCoeff
const llvm::SCEV* SrcConst
const llvm::SCEV* DstConst
const llvm::Loop* SrcLoop
const llvm::Loop* DstLoop

bool testBounds(
    unsigned char DirKind,
    unsigned int Level,
    llvm::DependenceInfo::BoundInfo* Bound,
    const llvm::SCEV* Delta) const

Description

testBounds - Returns true iff the current bounds are plausible.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:819

Parameters

unsigned char DirKind
unsigned int Level
llvm::DependenceInfo::BoundInfo* Bound
const llvm::SCEV* Delta

bool testMIV(const llvm::SCEV* Src,
             const llvm::SCEV* Dst,
             const llvm::SmallBitVector& Loops,
             llvm::FullDependence& Result) const

Description

testMIV - Tests the MIV subscript pair (Src and Dst) for dependence. Returns true if dependence disproved. Can sometimes refine direction vectors.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:635

Parameters

const llvm::SCEV* Src
const llvm::SCEV* Dst
const llvm::SmallBitVector& Loops
llvm::FullDependence& Result

bool testRDIV(const llvm::SCEV* Src,
              const llvm::SCEV* Dst,
              llvm::FullDependence& Result) const

Description

testRDIV - Tests the RDIV subscript pair (Src and Dst) for dependence. Things of the form [c1 + a1*i] and [c2 + a2*j] where i and j are induction variables, c1 and c2 are loop invariant, and a1 and a2 are constant. With minor algebra, this test can also be used for things like [c1 + a1*i + a2*j][c2]. Returns true if any possible dependence is disproved. If there might be a dependence, returns false. Marks the Result as inconsistent.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:628

Parameters

const llvm::SCEV* Src
const llvm::SCEV* Dst
llvm::FullDependence& Result

bool testSIV(const llvm::SCEV* Src,
             const llvm::SCEV* Dst,
             unsigned int& Level,
             llvm::FullDependence& Result,
             llvm::DependenceInfo::Constraint&
                 NewConstraint,
             const llvm::SCEV*& SplitIter) const

Description

testSIV - Tests the SIV subscript pair (Src and Dst) for dependence. Things of the form [c1 + a1*i] and [c2 + a2*j], where i and j are induction variables, c1 and c2 are loop invariant, and a1 and a2 are constant. Returns true if any possible dependence is disproved. If there might be a dependence, returns false. Sets appropriate direction vector entry and, when possible, the distance vector entry. If the dependence isn't proven to exist, marks the Result as inconsistent.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:612

Parameters

const llvm::SCEV* Src
const llvm::SCEV* Dst
unsigned int& Level
llvm::FullDependence& Result
llvm::DependenceInfo::Constraint& NewConstraint
const llvm::SCEV*& SplitIter

bool testZIV(const llvm::SCEV* Src,
             const llvm::SCEV* Dst,
             llvm::FullDependence& Result) const

Description

testZIV - Tests the ZIV subscript pair (Src and Dst) for dependence. Returns true if any possible dependence is disproved. If there might be a dependence, returns false. If the dependence isn't proven to exist, marks the Result as inconsistent.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:598

Parameters

const llvm::SCEV* Src
const llvm::SCEV* Dst
llvm::FullDependence& Result

bool tryDelinearize(
    llvm::Instruction* Src,
    llvm::Instruction* Dst,
    SmallVectorImpl<
        llvm::DependenceInfo::Subscript>& Pair)

Description

Given a linear access function, tries to recover subscripts for each dimension of the array element access.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:927

Parameters

llvm::Instruction* Src
llvm::Instruction* Dst
SmallVectorImpl<llvm::DependenceInfo::Subscript>& Pair

bool tryDelinearizeFixedSize(
    llvm::Instruction* Src,
    llvm::Instruction* Dst,
    const llvm::SCEV* SrcAccessFn,
    const llvm::SCEV* DstAccessFn,
    SmallVectorImpl<const llvm::SCEV*>&
        SrcSubscripts,
    SmallVectorImpl<const llvm::SCEV*>&
        DstSubscripts)

Description

Tries to delinearize \p Src and \p Dst access functions for a fixed size multi-dimensional array. Calls tryDelinearizeFixedSizeImpl() to delinearize \p Src and \p Dst separately,

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:933

Parameters

llvm::Instruction* Src
llvm::Instruction* Dst
const llvm::SCEV* SrcAccessFn
const llvm::SCEV* DstAccessFn
SmallVectorImpl<const llvm::SCEV*>& SrcSubscripts
SmallVectorImpl<const llvm::SCEV*>& DstSubscripts

bool tryDelinearizeParametricSize(
    llvm::Instruction* Src,
    llvm::Instruction* Dst,
    const llvm::SCEV* SrcAccessFn,
    const llvm::SCEV* DstAccessFn,
    SmallVectorImpl<const llvm::SCEV*>&
        SrcSubscripts,
    SmallVectorImpl<const llvm::SCEV*>&
        DstSubscripts)

Description

Tries to delinearize access function for a multi-dimensional array with symbolic runtime sizes. Returns true upon success and false otherwise.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:942

Parameters

llvm::Instruction* Src
llvm::Instruction* Dst
const llvm::SCEV* SrcAccessFn
const llvm::SCEV* DstAccessFn
SmallVectorImpl<const llvm::SCEV*>& SrcSubscripts
SmallVectorImpl<const llvm::SCEV*>& DstSubscripts

void unifySubscriptType(
    ArrayRef<llvm::DependenceInfo::Subscript*>
        Pairs)

Description

Makes sure all subscript pairs share the same integer type by sign-extending as necessary. Sign-extending a subscript is safe because getelementptr assumes the array subscripts are signed.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:527

Parameters

ArrayRef<llvm::DependenceInfo::Subscript*> Pairs

void updateDirection(
    Dependence::DVEntry& Level,
    const llvm::DependenceInfo::Constraint&
        CurConstraint) const

Description

updateDirection - Update direction vector entry based on the current constraint.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:922

Parameters

Dependence::DVEntry& Level
const llvm::DependenceInfo::Constraint& CurConstraint

bool weakCrossingSIVtest(
    const llvm::SCEV* SrcCoeff,
    const llvm::SCEV* SrcConst,
    const llvm::SCEV* DstConst,
    const llvm::Loop* CurrentLoop,
    unsigned int Level,
    llvm::FullDependence& Result,
    llvm::DependenceInfo::Constraint&
        NewConstraint,
    const llvm::SCEV*& SplitIter) const

Description

weakCrossingSIVtest - Tests the weak-crossing SIV subscript pair (Src and Dst) for dependence. Things of the form [c1 + a*i] and [c2 - a*i], where i is an induction variable, c1 and c2 are loop invariant, and a is a constant. Returns true if any possible dependence is disproved. If there might be a dependence, returns false. Sets appropriate direction entry. Set consistent to false. Marks the dependence as splitable.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:666

Parameters

const llvm::SCEV* SrcCoeff
const llvm::SCEV* SrcConst
const llvm::SCEV* DstConst
const llvm::Loop* CurrentLoop
unsigned int Level
llvm::FullDependence& Result
llvm::DependenceInfo::Constraint& NewConstraint
const llvm::SCEV*& SplitIter

bool weakZeroDstSIVtest(
    const llvm::SCEV* SrcCoeff,
    const llvm::SCEV* SrcConst,
    const llvm::SCEV* DstConst,
    const llvm::Loop* CurrentLoop,
    unsigned int Level,
    llvm::FullDependence& Result,
    llvm::DependenceInfo::Constraint&
        NewConstraint) const

Description

weakZeroDstSIVtest - Tests the weak-zero SIV subscript pair (Src and Dst) for dependence. Things of the form [c1 + a*i] and [c2], where i is an induction variable, c1 and c2 are loop invariant, and a is a constant. See also weakZeroSrcSIVtest. Returns true if any possible dependence is disproved. If there might be a dependence, returns false. Sets appropriate direction entry. Set consistent to false. If loop peeling will break the dependence, mark appropriately.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:721

Parameters

const llvm::SCEV* SrcCoeff
const llvm::SCEV* SrcConst
const llvm::SCEV* DstConst
const llvm::Loop* CurrentLoop
unsigned int Level
llvm::FullDependence& Result
llvm::DependenceInfo::Constraint& NewConstraint

bool weakZeroSrcSIVtest(
    const llvm::SCEV* DstCoeff,
    const llvm::SCEV* SrcConst,
    const llvm::SCEV* DstConst,
    const llvm::Loop* CurrentLoop,
    unsigned int Level,
    llvm::FullDependence& Result,
    llvm::DependenceInfo::Constraint&
        NewConstraint) const

Description

weakZeroSrcSIVtest - Tests the weak-zero SIV subscript pair (Src and Dst) for dependence. Things of the form [c1] and [c2 + a*i], where i is an induction variable, c1 and c2 are loop invariant, and a is a constant. See also weakZeroDstSIVtest. Returns true if any possible dependence is disproved. If there might be a dependence, returns false. Sets appropriate direction entry. Set consistent to false. If loop peeling will break the dependence, mark appropriately.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:703

Parameters

const llvm::SCEV* DstCoeff
const llvm::SCEV* SrcConst
const llvm::SCEV* DstConst
const llvm::Loop* CurrentLoop
unsigned int Level
llvm::FullDependence& Result
llvm::DependenceInfo::Constraint& NewConstraint

const llvm::SCEV* zeroCoefficient(
    const llvm::SCEV* Expr,
    const llvm::Loop* TargetLoop) const

Description

zeroCoefficient - Given a linear SCEV, return the SCEV given by zeroing out the coefficient corresponding to the specified loop. For example, given a*i + b*j + c*k, zeroing the coefficient corresponding to the j loop would yield a*i + c*k.

Declared at: llvm/include/llvm/Analysis/DependenceAnalysis.h:908

Parameters

const llvm::SCEV* Expr
const llvm::Loop* TargetLoop