|
Polly 22.0.0git
|
Pass to detect the maximal static control parts (Scops) of a function. More...
#include <ScopDetection.h>
Classes | |
| struct | DetectionContext |
| Context variables for SCoP detection. More... | |
| struct | LoopStats |
| Helper data structure to collect statistics about loop counts. More... | |
Public Types | |
| using | RegionSet = SetVector<const Region *> |
Public Member Functions | |
| int | getNextID () |
| ScopDetection (const DominatorTree &DT, ScalarEvolution &SE, LoopInfo &LI, RegionInfo &RI, AAResults &AA, OptimizationRemarkEmitter &ORE) | |
| void | detect (Function &F) |
| RegionInfo * | getRI () const |
| Get the RegionInfo stored in this pass. | |
| LoopInfo * | getLI () const |
| Get the LoopInfo stored in this pass. | |
| bool | isMaxRegionInScop (const Region &R, bool Verify=true) |
| Is the region is the maximum region of a Scop? | |
| DetectionContext * | getDetectionContext (const Region *R) const |
Return the detection context for R, nullptr if R was invalid. | |
| const RejectLog * | lookupRejectionLog (const Region *R) const |
Return the set of rejection causes for R. | |
| std::string | regionIsInvalidBecause (const Region *R) const |
| Get a message why a region is invalid. | |
Public Attributes | |
| RegionSet | ValidRegions |
| int | NextScopID = 0 |
Private Types | |
| using | DetectionContextMapTy |
| Map to remember detection contexts for all regions. | |
Private Member Functions | |
| void | removeCachedResults (const Region &R) |
Remove cached results for R. | |
| void | removeCachedResultsRecursively (const Region &R) |
Remove cached results for the children of R recursively. | |
| bool | involvesMultiplePtrs (const SCEV *S0, const SCEV *S1, Loop *Scope) const |
Check if S0 and S1 do contain multiple possibly aliasing pointers. | |
| bool | addOverApproximatedRegion (Region *AR, DetectionContext &Context) const |
Add the region AR as over approximated sub-region in Context. | |
| SmallVector< const SCEV *, 4 > | getDelinearizationTerms (DetectionContext &Context, const SCEVUnknown *BasePointer) const |
| Find for a given base pointer terms that hint towards dimension sizes of a multi-dimensional array. | |
| bool | hasValidArraySizes (DetectionContext &Context, SmallVectorImpl< const SCEV * > &Sizes, const SCEVUnknown *BasePointer, Loop *Scope) const |
| Check if the dimension size of a delinearized array is valid. | |
| bool | computeAccessFunctions (DetectionContext &Context, const SCEVUnknown *BasePointer, std::shared_ptr< ArrayShape > Shape) const |
| Derive access functions for a given base pointer. | |
| bool | hasBaseAffineAccesses (DetectionContext &Context, const SCEVUnknown *BasePointer, Loop *Scope) const |
| Check if all accesses to a given BasePointer are affine. | |
| bool | hasAffineMemoryAccesses (DetectionContext &Context) const |
| Delinearize all non affine memory accesses and return false when there exists a non affine memory access that cannot be delinearized. | |
| Region * | expandRegion (Region &R) |
| Try to expand the region R. | |
| void | findScops (Region &R) |
| Find the Scops in this region tree. | |
| bool | allBlocksValid (DetectionContext &Context) |
| Check if all basic block in the region are valid. | |
| bool | hasSufficientCompute (DetectionContext &Context, int NumAffineLoops) const |
| Check if a region has sufficient compute instructions. | |
| bool | hasPossiblyDistributableLoop (DetectionContext &Context) const |
| Check if the unique affine loop might be amendable to distribution. | |
| bool | isProfitableRegion (DetectionContext &Context) const |
| Check if a region is profitable to optimize. | |
| bool | isValidRegion (DetectionContext &Context) |
| Check if a region is a Scop. | |
| bool | isValidIntrinsicInst (IntrinsicInst &II, DetectionContext &Context) const |
| Check if an intrinsic call can be part of a Scop. | |
| bool | isValidCallInst (CallInst &CI, DetectionContext &Context) const |
| Check if a call instruction can be part of a Scop. | |
| bool | onlyValidRequiredInvariantLoads (InvariantLoadsSetTy &RequiredILS, DetectionContext &Context) const |
| Check if the given loads could be invariant and can be hoisted. | |
| bool | isInvariant (Value &Val, const Region &Reg, DetectionContext &Ctx) const |
| Check if a value is invariant in the region Reg. | |
| bool | isValidAccess (Instruction *Inst, const SCEV *AF, const SCEVUnknown *BP, DetectionContext &Context) const |
Check if the memory access caused by Inst is valid. | |
| bool | isValidMemoryAccess (MemAccInst Inst, DetectionContext &Context) const |
| Check if a memory access can be part of a Scop. | |
| bool | isValidInstruction (Instruction &Inst, DetectionContext &Context) |
| Check if an instruction can be part of a Scop. | |
| bool | isValidSwitch (BasicBlock &BB, SwitchInst *SI, Value *Condition, bool IsLoopBranch, DetectionContext &Context) const |
Check if the switch SI with condition Condition is valid. | |
| bool | isValidBranch (BasicBlock &BB, BranchInst *BI, Value *Condition, bool IsLoopBranch, DetectionContext &Context) |
Check if the branch BI with condition Condition is valid. | |
| bool | isAffine (const SCEV *S, Loop *Scope, DetectionContext &Context) const |
Check if the SCEV S is affine in the current Context. | |
| bool | isValidCFG (BasicBlock &BB, bool IsLoopBranch, bool AllowUnreachable, DetectionContext &Context) |
| Check if the control flow in a basic block is valid. | |
| bool | isValidLoop (Loop *L, DetectionContext &Context) |
| Is a loop valid with respect to a given region. | |
| bool | canUseISLTripCount (Loop *L, DetectionContext &Context) |
| Can ISL compute the trip count of a loop. | |
| void | printLocations (Function &F) |
| Print the locations of all detected scops. | |
| bool | isReducibleRegion (Region &R, DebugLoc &DbgLoc) const |
| Check if a region is reducible or not. | |
| template<class RR, typename... Args> | |
| bool | invalid (DetectionContext &Context, bool Assert, Args &&...Arguments) const |
| Track diagnostics for invalid scops. | |
Static Private Member Functions | |
| static ScopDetection::LoopStats | countBeneficialSubLoops (Loop *L, ScalarEvolution &SE, unsigned MinProfitableTrips) |
Count the number of loops and the maximal loop depth in L. | |
| static bool | isValidFunction (Function &F) |
Check if the function F is marked as invalid. | |
Private Attributes | |
| const DominatorTree & | DT |
| Analyses used. | |
| ScalarEvolution & | SE |
| LoopInfo & | LI |
| RegionInfo & | RI |
| AAResults & | AA |
| DetectionContextMapTy | DetectionContextMap |
| DenseMap< std::tuple< const BasicBlock *, const Region * >, bool > | ErrorBlockCache |
| Cache for the isErrorBlock function. | |
Maximum Region In Scops Iterators | |
These iterators iterator over all maximum region in Scops of this function. | |
| using | iterator = RegionSet::iterator |
| using | const_iterator = RegionSet::const_iterator |
| OptimizationRemarkEmitter & | ORE |
| OptimizationRemarkEmitter object used to emit diagnostic remarks. | |
| iterator | begin () |
| iterator | end () |
| const_iterator | begin () const |
| const_iterator | end () const |
| void | emitMissedRemarks (const Function &F) |
| Emit rejection remarks for all rejected regions. | |
| void | verifyAnalysis () |
| Verify if all valid Regions in this Function are still valid after some transformations. | |
| void | verifyRegion (const Region &R) |
| Verify if R is still a valid part of Scop after some transformations. | |
| bool | isErrorBlock (llvm::BasicBlock &BB, const llvm::Region &R) |
| Check if the block is a error block. | |
| static void | markFunctionAsInvalid (Function *F) |
| Mark the function as invalid so we will not extract any scop from the function. | |
| static ScopDetection::LoopStats | countBeneficialLoops (Region *R, ScalarEvolution &SE, LoopInfo &LI, unsigned MinProfitableTrips) |
Count the number of loops and the maximal loop depth in R. | |
Pass to detect the maximal static control parts (Scops) of a function.
Definition at line 131 of file ScopDetection.h.
| using polly::ScopDetection::const_iterator = RegionSet::const_iterator |
Definition at line 551 of file ScopDetection.h.
|
private |
Map to remember detection contexts for all regions.
Definition at line 214 of file ScopDetection.h.
| using polly::ScopDetection::iterator = RegionSet::iterator |
Definition at line 550 of file ScopDetection.h.
| using polly::ScopDetection::RegionSet = SetVector<const Region *> |
Definition at line 133 of file ScopDetection.h.
| ScopDetection::ScopDetection | ( | const DominatorTree & | DT, |
| ScalarEvolution & | SE, | ||
| LoopInfo & | LI, | ||
| RegionInfo & | RI, | ||
| AAResults & | AA, | ||
| OptimizationRemarkEmitter & | ORE ) |
|
private |
Add the region AR as over approximated sub-region in Context.
| AR | The non-affine subregion. |
| Context | The current detection context. |
Definition at line 450 of file ScopDetection.cpp.
References AllowNonAffineSubLoops(), polly::ScopDetection::DetectionContext::BoxedLoopsSet, LI, and polly::ScopDetection::DetectionContext::NonAffineSubRegionSet.
Referenced by isValidBranch(), isValidLoop(), and isValidSwitch().
|
private |
Check if all basic block in the region are valid.
| Context | The context of scop detection. |
Definition at line 1629 of file ScopDetection.cpp.
References polly::ScopDetection::DetectionContext::CurRegion, hasAffineMemoryAccesses(), invalid(), isErrorBlock(), polly::ScopDetection::DetectionContext::IsInvalid, isValidCFG(), isValidInstruction(), isValidLoop(), KeepGoing(), and LI.
Referenced by expandRegion(), and isValidRegion().
|
inline |
Definition at line 553 of file ScopDetection.h.
References ValidRegions.
Referenced by polly::ScopViewer::processFunction().
|
inline |
Definition at line 556 of file ScopDetection.h.
References ValidRegions.
|
private |
Can ISL compute the trip count of a loop.
| L | The loop to check. |
| Context | The context of scop detection. |
Definition at line 1273 of file ScopDetection.cpp.
References polly::ScopDetection::DetectionContext::IsInvalid, isValidCFG(), polly::ScopDetection::DetectionContext::Log, and polly::RejectLog::size().
Referenced by isValidLoop().
|
private |
Derive access functions for a given base pointer.
| Context | The current detection context. |
| Sizes | The sizes of the different array dimensions. |
| BasePointer | The base pointer of all the array for which to compute access functions. |
| Shape | The shape that describes the derived array sizes and which should be filled with newly computed access functions. |
Definition at line 980 of file ScopDetection.cpp.
References polly::ScopDetection::DetectionContext::Accesses, AllowNonAffine(), polly::MemAcc::DelinearizedSubscripts, polly::ScopDetection::DetectionContext::InsnToMemAcc, invalid(), isAffine(), KeepGoing(), LI, SE, and polly::Value.
Referenced by hasBaseAffineAccesses().
|
static |
Count the number of loops and the maximal loop depth in R.
| R | The region to check |
| SE | The scalar evolution analysis. |
| MinProfitableTrips | The minimum number of trip counts from which a loop is assumed to be profitable and consequently is counted. returns A tuple of number of loops and their maximal depth. |
Definition at line 1386 of file ScopDetection.cpp.
References countBeneficialSubLoops(), LI, polly::ScopDetection::LoopStats::MaxDepth, polly::ScopDetection::LoopStats::NumLoops, and SE.
Referenced by detect(), polly::Scop::getStatistics(), isProfitableRegion(), and polly::ScopInfo::recompute().
|
staticprivate |
Count the number of loops and the maximal loop depth in L.
Return the number of loops in L (incl.
| L | The loop to check. |
| SE | The scalar evolution analysis. |
| MinProfitableTrips | The minimum number of trip counts from which a loop is assumed to be profitable and consequently is counted. returns A tuple of number of loops and their maximal depth. |
L) that have a trip count that is not known to be less than @MinProfitableTrips.
Definition at line 1364 of file ScopDetection.cpp.
References countBeneficialSubLoops(), polly::ScopDetection::LoopStats::MaxDepth, polly::ScopDetection::LoopStats::NumLoops, and SE.
Referenced by countBeneficialLoops(), and countBeneficialSubLoops().
| void ScopDetection::detect | ( | Function & | F | ) |
Definition at line 341 of file ScopDetection.cpp.
References assert, countBeneficialLoops(), polly::ScopDetection::DetectionContext::CurRegion, DetectionContextMap, doesStringMatchAnyRegex(), emitMissedRemarks(), findScops(), polly::RejectLog::hasErrors(), IgnoredFunctions(), isProfitableRegion(), isValidFunction(), LI, polly::ScopDetection::DetectionContext::Log, polly::ScopDetection::LoopStats::NumLoops, OnlyFunctions(), polly::PollyProcessUnprofitable, polly::PollyTrackFailures, printLocations(), ReportLevel(), RI, SE, updateLoopCountStatistic(), and ValidRegions.
| void ScopDetection::emitMissedRemarks | ( | const Function & | F | ) |
Emit rejection remarks for all rejected regions.
| F | The function to emit remarks for. |
Definition at line 1831 of file ScopDetection.cpp.
References DetectionContextMap, polly::emitRejectionRemarks(), polly::RejectLog::hasErrors(), polly::ScopDetection::DetectionContext::Log, and ORE.
Referenced by detect().
|
inline |
Definition at line 554 of file ScopDetection.h.
References ValidRegions.
Referenced by polly::ScopViewer::processFunction().
|
inline |
Definition at line 557 of file ScopDetection.h.
References ValidRegions.
|
private |
Try to expand the region R.
If R can be expanded return the expanded region, NULL otherwise.
Definition at line 1483 of file ScopDetection.cpp.
References AA, allBlocksValid(), DetectionContextMap, polly::Entry, polly::getBBPairForRegion(), polly::RejectLog::hasErrors(), polly::ScopDetection::DetectionContext::Log, POLLY_DEBUG, and removeCachedResults().
Referenced by findScops().
|
private |
Find the Scops in this region tree.
| The | region tree to scan for scops. |
Definition at line 1563 of file ScopDetection.cpp.
References AA, assert, DetectionContextMap, polly::Entry, expandRegion(), findScops(), polly::getBBPairForRegion(), polly::RejectLog::hasErrors(), invalid(), polly::ScopDetection::DetectionContext::IsInvalid, isValidRegion(), KeepGoing(), LI, lookupRejectionLog(), polly::PollyProcessUnprofitable, regionWithoutLoops(), removeCachedResults(), removeCachedResultsRecursively(), and ValidRegions.
Referenced by detect(), and findScops().
|
private |
Find for a given base pointer terms that hint towards dimension sizes of a multi-dimensional array.
| Context | The current detection context. |
| BasePointer | A base pointer indicating the virtual array we are interested in. |
Definition at line 866 of file ScopDetection.cpp.
References polly::ScopDetection::DetectionContext::Accesses, polly::ScopDetection::DetectionContext::CurRegion, and SE.
Referenced by hasBaseAffineAccesses().
| ScopDetection::DetectionContext * ScopDetection::getDetectionContext | ( | const Region * | R | ) | const |
Return the detection context for R, nullptr if R was invalid.
Definition at line 1955 of file ScopDetection.cpp.
References DetectionContextMap, and polly::getBBPairForRegion().
Referenced by lookupRejectionLog().
|
inline |
Get the LoopInfo stored in this pass.
Definition at line 520 of file ScopDetection.h.
References LI.
|
inline |
Definition at line 199 of file ScopDetection.h.
References NextScopID.
|
inline |
Get the RegionInfo stored in this pass.
This was added to give the DOT printer easy access to this information.
Definition at line 517 of file ScopDetection.h.
References RI.
Referenced by llvm::GraphTraits< polly::ScopDetection * >::getEntryNode(), and llvm::DOTGraphTraits< polly::ScopDetection * >::getNodeLabel().
|
private |
Delinearize all non affine memory accesses and return false when there exists a non affine memory access that cannot be delinearized.
Return true when all array accesses are affine after delinearization.
Definition at line 1050 of file ScopDetection.cpp.
References AllowNonAffine(), hasBaseAffineAccesses(), polly::ScopDetection::DetectionContext::HasUnknownAccess, polly::ScopDetection::DetectionContext::IsInvalid, KeepGoing(), and polly::ScopDetection::DetectionContext::NonAffineAccesses.
Referenced by allBlocksValid().
|
private |
Check if all accesses to a given BasePointer are affine.
| Context | The current detection context. |
| BasePointer | the base pointer we are interested in. |
| Scope | The location where BasePointer is being used. |
| True | if consistent (multi-dimensional) array accesses could be derived for this array. |
Definition at line 1033 of file ScopDetection.cpp.
References computeAccessFunctions(), polly::ScopDetection::DetectionContext::ElementSize, getDelinearizationTerms(), hasValidArraySizes(), and SE.
Referenced by hasAffineMemoryAccesses().
|
private |
Check if the unique affine loop might be amendable to distribution.
This function checks if the number of non-trivial blocks in the unique affine loop in Context.CurRegion is at least two, thus if the loop might be amendable to distribution.
| Context | The context of scop detection. |
Definition at line 1694 of file ScopDetection.cpp.
References polly::ScopDetection::DetectionContext::BoxedLoopsSet, polly::ScopDetection::DetectionContext::CurRegion, and LI.
Referenced by isProfitableRegion().
|
private |
Check if a region has sufficient compute instructions.
This function checks if a region has a non-trivial number of instructions in each loop. This can be used as an indicator whether a loop is worth optimizing.
| Context | The context of scop detection. |
| NumLoops | The number of loops in the region. |
Definition at line 1678 of file ScopDetection.cpp.
References polly::ScopDetection::DetectionContext::CurRegion, LI, and ProfitabilityMinPerLoopInstructions().
Referenced by isProfitableRegion().
|
private |
Check if the dimension size of a delinearized array is valid.
| Context | The current detection context. |
| Sizes | The sizes of the different array dimensions. |
| BasePointer | The base pointer we are interested in. |
| Scope | The location where BasePointer is being used. |
Definition at line 915 of file ScopDetection.cpp.
References polly::ScopDetection::DetectionContext::Accesses, AllowNonAffine(), polly::ScopDetection::DetectionContext::CurRegion, DT, polly::hasScalarDepsInsideRegion(), invalid(), isAffine(), polly::isHoistableLoad(), KeepGoing(), LI, polly::ScopDetection::DetectionContext::RequiredILS, SE, and polly::Value.
Referenced by hasBaseAffineAccesses().
|
inlineprivate |
Track diagnostics for invalid scops.
| Context | The context of scop detection. |
| Assert | Throw an assert in verify mode or not. |
| Args | Argument list that gets passed to the constructor of RR. |
Definition at line 395 of file ScopDetection.cpp.
References assert, polly::RejectReason::getMessage(), polly::ScopDetection::DetectionContext::IsInvalid, polly::ScopDetection::DetectionContext::Log, POLLY_DEBUG, polly::RejectLog::report(), and polly::ScopDetection::DetectionContext::Verifying.
Referenced by allBlocksValid(), computeAccessFunctions(), findScops(), hasValidArraySizes(), isProfitableRegion(), isValidAccess(), isValidBranch(), isValidCFG(), isValidInstruction(), isValidLoop(), isValidRegion(), and isValidSwitch().
|
private |
Check if S0 and S1 do contain multiple possibly aliasing pointers.
| S0 | A expression to check. |
| S1 | Another expression to check or nullptr. |
| Scope | The loop/scope the expressions are checked in. |
S0 (and S1 if given). Definition at line 504 of file ScopDetection.cpp.
References AA, polly::findValues(), S1(), SE, and polly::Value.
Referenced by isValidBranch(), and isValidSwitch().
|
private |
Check if the SCEV S is affine in the current Context.
This will also use a heuristic to decide if we want to require loads to be invariant to make the expression affine or if we want to treat is as non-affine.
| S | The expression to be checked. |
| Scope | The loop nest in which S is used. |
| Context | The context of scop detection. |
Definition at line 538 of file ScopDetection.cpp.
References polly::ScopDetection::DetectionContext::CurRegion, polly::isAffineExpr(), onlyValidRequiredInvariantLoads(), and SE.
Referenced by computeAccessFunctions(), hasValidArraySizes(), isValidAccess(), isValidBranch(), isValidIntrinsicInst(), and isValidSwitch().
| bool ScopDetection::isErrorBlock | ( | llvm::BasicBlock & | BB, |
| const llvm::Region & | R ) |
Check if the block is a error block.
A error block is currently any block that fulfills at least one of the following conditions:
| BB | The block to check. |
| R | The analyzed region. |
Definition at line 1470 of file ScopDetection.cpp.
References DT, ErrorBlockCache, isErrorBlockImpl(), LI, and PollyAllowErrorBlocks().
Referenced by allBlocksValid(), containsErrorBlock(), and isValidInstruction().
|
private |
Check if a value is invariant in the region Reg.
| Val | Value to check for invariance. |
| Reg | The region to consider for the invariance of Val. |
| Ctx | The current detection context. |
Definition at line 800 of file ScopDetection.cpp.
References Ctx, LI, and polly::Value.
Referenced by isValidAccess().
| bool ScopDetection::isMaxRegionInScop | ( | const Region & | R, |
| bool | Verify = true ) |
Is the region is the maximum region of a Scop?
| R | The Region to test if it is maximum. |
| Verify | Rerun the scop detection to verify SCoP was not invalidated meanwhile. Do not use if the region's DetectionContect is referenced by a Scop that is still to be processed. |
Definition at line 415 of file ScopDetection.cpp.
References AA, DetectionContextMap, polly::Entry, polly::getBBPairForRegion(), isValidRegion(), ValidRegions, and Verify().
Referenced by verifyRegion().
|
private |
Check if a region is profitable to optimize.
Regions that are unlikely to expose interesting optimization opportunities are called 'unprofitable' and may be skipped during scop detection.
| Context | The context of scop detection. |
Definition at line 1716 of file ScopDetection.cpp.
References polly::ScopDetection::DetectionContext::BoxedLoopsSet, countBeneficialLoops(), polly::ScopDetection::DetectionContext::CurRegion, polly::ScopDetection::DetectionContext::hasLoads, hasPossiblyDistributableLoop(), polly::ScopDetection::DetectionContext::hasStores, hasSufficientCompute(), invalid(), LI, MIN_LOOP_TRIP_COUNT, polly::ScopDetection::LoopStats::NumLoops, polly::PollyProcessUnprofitable, and SE.
Referenced by detect().
|
private |
Check if a region is reducible or not.
| Region | The region to check. |
| DbgLoc | Parameter to save the location of instruction that causes irregular control flow if the region is irreducible. |
Enum for coloring BBs in Region.
WHITE - Unvisited BB in DFS walk. GREY - BBs which are currently on the DFS stack for processing. BLACK - Visited and completely processed BB.
Definition at line 1839 of file ScopDetection.cpp.
References DT.
Referenced by isValidRegion().
|
private |
Check if the memory access caused by Inst is valid.
| Inst | The access instruction. |
| AF | The access function. |
| BP | The access base pointer. |
| Context | The current detection context. |
Definition at line 1068 of file ScopDetection.cpp.
References polly::ScopDetection::DetectionContext::Accesses, AllowDifferentTypes(), AllowNonAffine(), polly::ScopDetection::DetectionContext::AST, polly::ScopDetection::DetectionContext::BoxedLoopsSet, polly::ScopDetection::DetectionContext::CurRegion, DT, polly::ScopDetection::DetectionContext::ElementSize, polly::findLoops(), IgnoreAliasing(), invalid(), isAffine(), polly::isHoistableLoad(), isInvariant(), LI, polly::ScopDetection::DetectionContext::NonAffineAccesses, polly::PollyDelinearize, polly::PollyUseRuntimeAliasChecks, polly::ScopDetection::DetectionContext::RequiredILS, SE, and polly::Value.
Referenced by isValidIntrinsicInst(), and isValidMemoryAccess().
|
private |
Check if the branch BI with condition Condition is valid.
| BB | The block to check. |
| BI | The branch to check. |
| Condition | The branch condition. |
| IsLoopBranch | Flag to indicate the branch is a loop exit/latch. |
| Context | The context of scop detection. |
Definition at line 574 of file ScopDetection.cpp.
References addOverApproximatedRegion(), AllowNonAffineSubRegions(), polly::ScopDetection::DetectionContext::CurRegion, polly::getUniqueNonErrorValue(), invalid(), involvesMultiplePtrs(), isAffine(), isValidBranch(), LI, polly::PHI, polly::PollyAllowUnsignedOperations, polly::ScopDetection::DetectionContext::RequiredILS, RI, SE, polly::tryForwardThroughPHI(), and polly::Value.
Referenced by isValidBranch(), and isValidCFG().
|
private |
Check if a call instruction can be part of a Scop.
| CI | The call instruction to check. |
| Context | The current detection context. |
Definition at line 686 of file ScopDetection.cpp.
References AA, AllowModrefCall(), polly::ScopDetection::DetectionContext::AST, polly::ScopDetection::DetectionContext::HasUnknownAccess, polly::isDebugCall(), isValidIntrinsicInst(), LI, POLLY_DEBUG, and SE.
Referenced by isValidInstruction().
|
private |
Check if the control flow in a basic block is valid.
This function checks if a certain basic block is terminated by a Terminator instruction we can handle or, if this is not the case, registers this basic block as the start of a non-affine region.
This function optionally allows unreachable statements.
| BB | The BB to check the control flow. |
| IsLoopBranch | Flag to indicate the branch is a loop exit/latch. |
| AllowUnreachable | Allow unreachable statements. |
| Context | The context of scop detection. |
Definition at line 654 of file ScopDetection.cpp.
References assert, polly::ScopDetection::DetectionContext::CurRegion, polly::getConditionFromTerminator(), invalid(), isValidBranch(), isValidSwitch(), and polly::Value.
Referenced by allBlocksValid(), and canUseISLTripCount().
|
staticprivate |
Check if the function F is marked as invalid.
Definition at line 1816 of file ScopDetection.cpp.
References polly::PollySkipFnAttr.
Referenced by detect().
|
private |
Check if an instruction can be part of a Scop.
| Inst | The instruction to check. |
| Context | The context of scop detection. |
Definition at line 1207 of file ScopDetection.cpp.
References polly::ScopDetection::DetectionContext::CurRegion, polly::MemAccInst::dyn_cast(), polly::ScopDetection::DetectionContext::hasLoads, polly::ScopDetection::DetectionContext::hasStores, invalid(), isErrorBlock(), isValidCallInst(), isValidMemoryAccess(), and polly::PHI.
Referenced by allBlocksValid().
|
private |
Check if an intrinsic call can be part of a Scop.
| II | The intrinsic call instruction to check. |
| Context | The current detection context. |
Definition at line 754 of file ScopDetection.cpp.
References isAffine(), polly::isIgnoredIntrinsic(), isValidAccess(), LI, and SE.
Referenced by isValidCallInst().
|
private |
Is a loop valid with respect to a given region.
| L | The loop to check. |
| Context | The context of scop detection. |
Definition at line 1300 of file ScopDetection.cpp.
References addOverApproximatedRegion(), AllowNonAffineSubLoops(), AllowNonAffineSubRegions(), canUseISLTripCount(), polly::ScopDetection::DetectionContext::CurRegion, hasExitingBlocks(), invalid(), RI, and SE.
Referenced by allBlocksValid().
|
private |
Check if a memory access can be part of a Scop.
| Inst | The instruction accessing the memory. |
| Context | The context of scop detection. |
Definition at line 1195 of file ScopDetection.cpp.
References polly::MemAccInst::getPointerOperand(), isValidAccess(), LI, SE, and polly::Value.
Referenced by isValidInstruction().
|
private |
Check if a region is a Scop.
| Context | The context of scop detection. |
Definition at line 1752 of file ScopDetection.cpp.
References allBlocksValid(), polly::ScopDetection::DetectionContext::CurRegion, invalid(), polly::ScopDetection::DetectionContext::IsInvalid, isReducibleRegion(), OnlyRegion(), POLLY_DEBUG, and polly::PollyAllowFullFunction.
Referenced by findScops(), isMaxRegionInScop(), and verifyRegion().
|
private |
Check if the switch SI with condition Condition is valid.
| BB | The block to check. |
| SI | The switch to check. |
| Condition | The switch condition. |
| IsLoopBranch | Flag to indicate the branch is a loop exit/latch. |
| Context | The context of scop detection. |
Definition at line 550 of file ScopDetection.cpp.
References addOverApproximatedRegion(), AllowNonAffineSubRegions(), invalid(), involvesMultiplePtrs(), isAffine(), LI, RI, SE, and polly::Value.
Referenced by isValidCFG().
| const RejectLog * ScopDetection::lookupRejectionLog | ( | const Region * | R | ) | const |
Return the set of rejection causes for R.
Definition at line 1962 of file ScopDetection.cpp.
References getDetectionContext(), and polly::ScopDetection::DetectionContext::Log.
Referenced by findScops(), and regionIsInvalidBecause().
|
static |
Mark the function as invalid so we will not extract any scop from the function.
| F | The function to mark as invalid. |
Definition at line 1812 of file ScopDetection.cpp.
References polly::PollySkipFnAttr.
|
private |
Check if the given loads could be invariant and can be hoisted.
If true is returned the loads are added to the required invariant loads contained in the Context.
| RequiredILS | The loads to check. |
| Context | The current detection context. |
Definition at line 468 of file ScopDetection.cpp.
References polly::ScopDetection::DetectionContext::CurRegion, DT, polly::isHoistableLoad(), LI, polly::ScopDetection::DetectionContext::NonAffineSubRegionSet, polly::PollyInvariantLoadHoisting, polly::ScopDetection::DetectionContext::RequiredILS, and SE.
Referenced by isAffine().
|
private |
Print the locations of all detected scops.
Definition at line 1820 of file ScopDetection.cpp.
References polly::getDebugLocation().
Referenced by detect().
| std::string ScopDetection::regionIsInvalidBecause | ( | const Region * | R | ) | const |
Get a message why a region is invalid.
| R | The region for which we get the error message |
Definition at line 436 of file ScopDetection.cpp.
References lookupRejectionLog().
|
private |
Remove cached results for R.
Definition at line 1559 of file ScopDetection.cpp.
References ValidRegions.
Referenced by expandRegion(), findScops(), and removeCachedResultsRecursively().
|
private |
Remove cached results for the children of R recursively.
Definition at line 1550 of file ScopDetection.cpp.
References removeCachedResults(), removeCachedResultsRecursively(), and ValidRegions.
Referenced by findScops(), and removeCachedResultsRecursively().
| void ScopDetection::verifyAnalysis | ( | ) |
Verify if all valid Regions in this Function are still valid after some transformations.
Definition at line 1974 of file ScopDetection.cpp.
References ValidRegions, verifyRegion(), and VerifyScops().
| void ScopDetection::verifyRegion | ( | const Region & | R | ) |
Verify if R is still a valid part of Scop after some transformations.
| R | The Region to verify. |
Definition at line 1967 of file ScopDetection.cpp.
References AA, assert, isMaxRegionInScop(), and isValidRegion().
Referenced by verifyAnalysis().
|
private |
Definition at line 210 of file ScopDetection.h.
Referenced by polly::ScopDetection::DetectionContext::DetectionContext(), expandRegion(), findScops(), involvesMultiplePtrs(), isMaxRegionInScop(), isValidCallInst(), ScopDetection(), and verifyRegion().
|
private |
Definition at line 216 of file ScopDetection.h.
Referenced by detect(), emitMissedRemarks(), expandRegion(), findScops(), getDetectionContext(), and isMaxRegionInScop().
|
private |
Analyses used.
Definition at line 206 of file ScopDetection.h.
Referenced by hasValidArraySizes(), isErrorBlock(), isReducibleRegion(), isValidAccess(), onlyValidRequiredInvariantLoads(), and ScopDetection().
|
private |
Cache for the isErrorBlock function.
Definition at line 220 of file ScopDetection.h.
Referenced by isErrorBlock().
|
private |
Definition at line 208 of file ScopDetection.h.
Referenced by addOverApproximatedRegion(), allBlocksValid(), computeAccessFunctions(), countBeneficialLoops(), detect(), findScops(), getLI(), hasPossiblyDistributableLoop(), hasSufficientCompute(), hasValidArraySizes(), isErrorBlock(), isInvariant(), isProfitableRegion(), isValidAccess(), isValidBranch(), isValidCallInst(), isValidIntrinsicInst(), isValidMemoryAccess(), isValidSwitch(), onlyValidRequiredInvariantLoads(), and ScopDetection().
| int polly::ScopDetection::NextScopID = 0 |
Definition at line 198 of file ScopDetection.h.
Referenced by getNextID().
|
private |
OptimizationRemarkEmitter object used to emit diagnostic remarks.
Definition at line 612 of file ScopDetection.h.
Referenced by emitMissedRemarks(), and ScopDetection().
|
private |
Definition at line 209 of file ScopDetection.h.
Referenced by detect(), getRI(), isValidBranch(), isValidLoop(), isValidSwitch(), and ScopDetection().
|
private |
Definition at line 207 of file ScopDetection.h.
Referenced by computeAccessFunctions(), countBeneficialLoops(), countBeneficialSubLoops(), detect(), getDelinearizationTerms(), hasBaseAffineAccesses(), hasValidArraySizes(), involvesMultiplePtrs(), isAffine(), isProfitableRegion(), isValidAccess(), isValidBranch(), isValidCallInst(), isValidIntrinsicInst(), isValidLoop(), isValidMemoryAccess(), isValidSwitch(), onlyValidRequiredInvariantLoads(), and ScopDetection().
| RegionSet polly::ScopDetection::ValidRegions |
Definition at line 136 of file ScopDetection.h.
Referenced by begin(), begin(), detect(), end(), end(), findScops(), isMaxRegionInScop(), removeCachedResults(), removeCachedResultsRecursively(), and verifyAnalysis().