Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
DependenceAnalysis.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "da"

Functions

 STATISTIC (TotalArrayPairs, "Array pairs tested")
 STATISTIC (SeparableSubscriptPairs, "Separable subscript pairs")
 STATISTIC (CoupledSubscriptPairs, "Coupled subscript pairs")
 STATISTIC (NonlinearSubscriptPairs, "Nonlinear subscript pairs")
 STATISTIC (ZIVapplications, "ZIV applications")
 STATISTIC (ZIVindependence, "ZIV independence")
 STATISTIC (StrongSIVapplications, "Strong SIV applications")
 STATISTIC (StrongSIVsuccesses, "Strong SIV successes")
 STATISTIC (StrongSIVindependence, "Strong SIV independence")
 STATISTIC (WeakCrossingSIVapplications, "Weak-Crossing SIV applications")
 STATISTIC (WeakCrossingSIVsuccesses, "Weak-Crossing SIV successes")
 STATISTIC (WeakCrossingSIVindependence, "Weak-Crossing SIV independence")
 STATISTIC (ExactSIVapplications, "Exact SIV applications")
 STATISTIC (ExactSIVsuccesses, "Exact SIV successes")
 STATISTIC (ExactSIVindependence, "Exact SIV independence")
 STATISTIC (WeakZeroSIVapplications, "Weak-Zero SIV applications")
 STATISTIC (WeakZeroSIVsuccesses, "Weak-Zero SIV successes")
 STATISTIC (WeakZeroSIVindependence, "Weak-Zero SIV independence")
 STATISTIC (ExactRDIVapplications, "Exact RDIV applications")
 STATISTIC (ExactRDIVindependence, "Exact RDIV independence")
 STATISTIC (SymbolicRDIVapplications, "Symbolic RDIV applications")
 STATISTIC (SymbolicRDIVindependence, "Symbolic RDIV independence")
 STATISTIC (DeltaApplications, "Delta applications")
 STATISTIC (DeltaSuccesses, "Delta successes")
 STATISTIC (DeltaIndependence, "Delta independence")
 STATISTIC (DeltaPropagations, "Delta propagations")
 STATISTIC (GCDapplications, "GCD applications")
 STATISTIC (GCDsuccesses, "GCD successes")
 STATISTIC (GCDindependence, "GCD independence")
 STATISTIC (BanerjeeApplications, "Banerjee applications")
 STATISTIC (BanerjeeIndependence, "Banerjee independence")
 STATISTIC (BanerjeeSuccesses, "Banerjee successes")
 STATISTIC (SameSDLoopsCount, "Loops with Same iteration Space and Depth")
 INITIALIZE_PASS_BEGIN (DependenceAnalysisWrapperPass, "da", "Dependence Analysis", true, true) INITIALIZE_PASS_END(DependenceAnalysisWrapperPass
static void dumpExampleDependence (raw_ostream &OS, DependenceInfo *DA, ScalarEvolution &SE, bool NormalizeResults)
static AliasResult underlyingObjectsAlias (AAResults *AA, const DataLayout &DL, const MemoryLocation &LocA, const MemoryLocation &LocB)
static bool isLoadOrStore (const Instruction *I)
static const SCEVminusSCEVNoSignedOverflow (const SCEV *A, const SCEV *B, ScalarEvolution &SE)
 Returns A - B if it guaranteed not to signed wrap.
static bool findGCD (unsigned Bits, const APInt &AM, const APInt &BM, const APInt &Delta, APInt &G, APInt &X, APInt &Y)
static APInt floorOfQuotient (const APInt &A, const APInt &B)
static APInt ceilingOfQuotient (const APInt &A, const APInt &B)
static std::pair< std::optional< APInt >, std::optional< APInt > > inferDomainOfAffine (const APInt &A, const APInt &B, const std::optional< APInt > &UB)
 Given an affine expression of the form A*k + B, where k is an arbitrary integer, infer the possible range of k based on the known range of the affine expression.
static bool isRemainderZero (const SCEVConstant *Dividend, const SCEVConstant *Divisor)
static std::optional< APIntgetConstantPart (const SCEV *Expr)
static void dumpSmallBitVector (SmallBitVector &BV)

Variables

static cl::opt< boolDelinearize ("da-delinearize", cl::init(true), cl::Hidden, cl::desc("Try to delinearize array references."))
static cl::opt< boolDisableDelinearizationChecks ("da-disable-delinearization-checks", cl::Hidden, cl::desc("Disable checks that try to statically verify validity of " "delinearized subscripts. Enabling this option may result in incorrect " "dependence vectors for languages that allow the subscript of one " "dimension to underflow or overflow into another dimension."))
static cl::opt< unsignedMIVMaxLevelThreshold ("da-miv-max-level-threshold", cl::init(7), cl::Hidden, cl::desc("Maximum depth allowed for the recursive algorithm used to " "explore MIV direction vectors."))
static cl::opt< boolRunSIVRoutinesOnly ("da-run-siv-routines-only", cl::init(false), cl::ReallyHidden, cl::desc("Run only SIV routines and disable others (ZIV, RDIV, and MIV). " "The purpose is mainly to exclude the influence of those routines " "in regression tests for SIV routines."))
 da
Dependence Analysis
Dependence true

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "da"

Definition at line 70 of file DependenceAnalysis.cpp.

Function Documentation

◆ ceilingOfQuotient()

APInt ceilingOfQuotient ( const APInt & A,
const APInt & B )
static

Definition at line 1627 of file DependenceAnalysis.cpp.

References A(), B(), and llvm::APInt::sdivrem().

Referenced by inferDomainOfAffine().

◆ dumpExampleDependence()

◆ dumpSmallBitVector()

void dumpSmallBitVector ( SmallBitVector & BV)
static

◆ findGCD()

bool findGCD ( unsigned Bits,
const APInt & AM,
const APInt & BM,
const APInt & Delta,
APInt & G,
APInt & X,
APInt & Y )
static

◆ floorOfQuotient()

APInt floorOfQuotient ( const APInt & A,
const APInt & B )
static

Definition at line 1615 of file DependenceAnalysis.cpp.

References A(), B(), and llvm::APInt::sdivrem().

Referenced by inferDomainOfAffine().

◆ getConstantPart()

std::optional< APInt > getConstantPart ( const SCEV * Expr)
static

Definition at line 2485 of file DependenceAnalysis.cpp.

References llvm::dyn_cast().

◆ inferDomainOfAffine()

std::pair< std::optional< APInt >, std::optional< APInt > > inferDomainOfAffine ( const APInt & A,
const APInt & B,
const std::optional< APInt > & UB )
static

Given an affine expression of the form A*k + B, where k is an arbitrary integer, infer the possible range of k based on the known range of the affine expression.

If we know A*k + B is non-negative, i.e.,

A*k + B >= 0

we can derive the following inequalities for k when A is positive:

k >= -B / A

Since k is an integer, it means k is greater than or equal to the ceil(-B / A).

If the upper bound of the affine expression UB is passed, the following inequality can be derived as well:

A*k + B <= UB

which leads to:

k <= (UB - B) / A

Again, as k is an integer, it means k is less than or equal to the floor((UB - B) / A).

The similar logic applies when A is negative, but the inequalities sign flip while working with them.

Preconditions: A is non-zero, and we know A*k + B is non-negative.

Definition at line 1669 of file DependenceAnalysis.cpp.

References A(), assert(), B(), ceilingOfQuotient(), llvm::dbgs(), floorOfQuotient(), and LLVM_DEBUG.

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( DependenceAnalysisWrapperPass ,
"da" ,
"Dependence Analysis" ,
true ,
true  )

◆ isLoadOrStore()

bool isLoadOrStore ( const Instruction * I)
static

◆ isRemainderZero()

bool isRemainderZero ( const SCEVConstant * Dividend,
const SCEVConstant * Divisor )
static

Definition at line 1857 of file DependenceAnalysis.cpp.

References llvm::SCEVConstant::getAPInt(), and llvm::APInt::srem().

◆ minusSCEVNoSignedOverflow()

const SCEV * minusSCEVNoSignedOverflow ( const SCEV * A,
const SCEV * B,
ScalarEvolution & SE )
static

Returns A - B if it guaranteed not to signed wrap.

Otherwise returns nullptr. A and B must have the same integer type.

Definition at line 1260 of file DependenceAnalysis.cpp.

References A(), B(), llvm::ScalarEvolution::getMinusSCEV(), and llvm::ScalarEvolution::willNotOverflow().

◆ STATISTIC() [1/33]

STATISTIC ( BanerjeeApplications ,
"Banerjee applications"  )

◆ STATISTIC() [2/33]

STATISTIC ( BanerjeeIndependence ,
"Banerjee independence"  )

◆ STATISTIC() [3/33]

STATISTIC ( BanerjeeSuccesses ,
"Banerjee successes"  )

◆ STATISTIC() [4/33]

STATISTIC ( CoupledSubscriptPairs ,
"Coupled subscript pairs"  )

◆ STATISTIC() [5/33]

STATISTIC ( DeltaApplications ,
"Delta applications"  )

◆ STATISTIC() [6/33]

STATISTIC ( DeltaIndependence ,
"Delta independence"  )

◆ STATISTIC() [7/33]

STATISTIC ( DeltaPropagations ,
"Delta propagations"  )

◆ STATISTIC() [8/33]

STATISTIC ( DeltaSuccesses ,
"Delta successes"  )

◆ STATISTIC() [9/33]

STATISTIC ( ExactRDIVapplications ,
"Exact RDIV applications"  )

◆ STATISTIC() [10/33]

STATISTIC ( ExactRDIVindependence ,
"Exact RDIV independence"  )

◆ STATISTIC() [11/33]

STATISTIC ( ExactSIVapplications ,
"Exact SIV applications"  )

◆ STATISTIC() [12/33]

STATISTIC ( ExactSIVindependence ,
"Exact SIV independence"  )

◆ STATISTIC() [13/33]

STATISTIC ( ExactSIVsuccesses ,
"Exact SIV successes"  )

◆ STATISTIC() [14/33]

STATISTIC ( GCDapplications ,
"GCD applications"  )

◆ STATISTIC() [15/33]

STATISTIC ( GCDindependence ,
"GCD independence"  )

◆ STATISTIC() [16/33]

STATISTIC ( GCDsuccesses ,
"GCD successes"  )

◆ STATISTIC() [17/33]

STATISTIC ( NonlinearSubscriptPairs ,
"Nonlinear subscript pairs"  )

◆ STATISTIC() [18/33]

STATISTIC ( SameSDLoopsCount ,
"Loops with Same iteration Space and Depth"  )

◆ STATISTIC() [19/33]

STATISTIC ( SeparableSubscriptPairs ,
"Separable subscript pairs"  )

◆ STATISTIC() [20/33]

STATISTIC ( StrongSIVapplications ,
"Strong SIV applications"  )

◆ STATISTIC() [21/33]

STATISTIC ( StrongSIVindependence ,
"Strong SIV independence"  )

◆ STATISTIC() [22/33]

STATISTIC ( StrongSIVsuccesses ,
"Strong SIV successes"  )

◆ STATISTIC() [23/33]

STATISTIC ( SymbolicRDIVapplications ,
"Symbolic RDIV applications"  )

◆ STATISTIC() [24/33]

STATISTIC ( SymbolicRDIVindependence ,
"Symbolic RDIV independence"  )

◆ STATISTIC() [25/33]

STATISTIC ( TotalArrayPairs ,
"Array pairs tested"  )

◆ STATISTIC() [26/33]

STATISTIC ( WeakCrossingSIVapplications ,
"Weak-Crossing SIV applications"  )

◆ STATISTIC() [27/33]

STATISTIC ( WeakCrossingSIVindependence ,
"Weak-Crossing SIV independence"  )

◆ STATISTIC() [28/33]

STATISTIC ( WeakCrossingSIVsuccesses ,
"Weak-Crossing SIV successes"  )

◆ STATISTIC() [29/33]

STATISTIC ( WeakZeroSIVapplications ,
"Weak-Zero SIV applications"  )

◆ STATISTIC() [30/33]

STATISTIC ( WeakZeroSIVindependence ,
"Weak-Zero SIV independence"  )

◆ STATISTIC() [31/33]

STATISTIC ( WeakZeroSIVsuccesses ,
"Weak-Zero SIV successes"  )

◆ STATISTIC() [32/33]

STATISTIC ( ZIVapplications ,
"ZIV applications"  )

◆ STATISTIC() [33/33]

STATISTIC ( ZIVindependence ,
"ZIV independence"  )

◆ underlyingObjectsAlias()

Variable Documentation

◆ Analysis

Dependence Analysis

Definition at line 149 of file DependenceAnalysis.cpp.

◆ da

da

Definition at line 149 of file DependenceAnalysis.cpp.

◆ Delinearize

cl::opt< bool > Delinearize("da-delinearize", cl::init(true), cl::Hidden, cl::desc("Try to delinearize array references.")) ( "da-delinearize" ,
cl::init(true) ,
cl::Hidden ,
cl::desc("Try to delinearize array references.")  )
static

◆ DisableDelinearizationChecks

cl::opt< bool > DisableDelinearizationChecks("da-disable-delinearization-checks", cl::Hidden, cl::desc( "Disable checks that try to statically verify validity of " "delinearized subscripts. Enabling this option may result in incorrect " "dependence vectors for languages that allow the subscript of one " "dimension to underflow or overflow into another dimension.")) ( "da-disable-delinearization-checks" ,
cl::Hidden ,
cl::desc( "Disable checks that try to statically verify validity of " "delinearized subscripts. Enabling this option may result in incorrect " "dependence vectors for languages that allow the subscript of one " "dimension to underflow or overflow into another dimension.")  )
static

◆ MIVMaxLevelThreshold

cl::opt< unsigned > MIVMaxLevelThreshold("da-miv-max-level-threshold", cl::init(7), cl::Hidden, cl::desc("Maximum depth allowed for the recursive algorithm used to " "explore MIV direction vectors.")) ( "da-miv-max-level-threshold" ,
cl::init(7) ,
cl::Hidden ,
cl::desc("Maximum depth allowed for the recursive algorithm used to " "explore MIV direction vectors.")  )
static

◆ RunSIVRoutinesOnly

cl::opt< bool > RunSIVRoutinesOnly("da-run-siv-routines-only", cl::init(false), cl::ReallyHidden, cl::desc("Run only SIV routines and disable others (ZIV, RDIV, and MIV). " "The purpose is mainly to exclude the influence of those routines " "in regression tests for SIV routines.")) ( "da-run-siv-routines-only" ,
cl::init(false) ,
cl::ReallyHidden ,
cl::desc("Run only SIV routines and disable others (ZIV, RDIV, and MIV). " "The purpose is mainly to exclude the influence of those routines " "in regression tests for SIV routines.")  )
static

◆ true

Dependence true

Definition at line 150 of file DependenceAnalysis.cpp.