diff options
author | Michael Kruse <llvm-project@meinersbur.de> | 2022-10-20 11:49:38 -0500 |
---|---|---|
committer | Michael Kruse <llvm-project@meinersbur.de> | 2022-10-20 13:35:09 -0500 |
commit | b4b7fa234cfaea5267449654de8297ee860f094e (patch) | |
tree | 9651bf3091f6f46fd4e0575ef0a1b1e9cd6d0af6 /polly/include | |
parent | 3fee9358baab54e4ed646a106297e7fb6f1b4cff (diff) | |
download | llvm-b4b7fa234cfaea5267449654de8297ee860f094e.tar.gz |
[Polly] Ensure -polly-detect-keep-going still eventually rejects invalid regions.
Fixes #58484
Diffstat (limited to 'polly/include')
-rw-r--r-- | polly/include/polly/ScopBuilder.h | 4 | ||||
-rw-r--r-- | polly/include/polly/ScopDetection.h | 38 | ||||
-rw-r--r-- | polly/include/polly/Support/ScopHelper.h | 1 |
3 files changed, 16 insertions, 27 deletions
diff --git a/polly/include/polly/ScopBuilder.h b/polly/include/polly/ScopBuilder.h index d4c6441e7e8d..635c23ca7f97 100644 --- a/polly/include/polly/ScopBuilder.h +++ b/polly/include/polly/ScopBuilder.h @@ -296,7 +296,9 @@ class ScopBuilder final { /// /// @param Inst The Load/Store instruction that access the memory /// @param Stmt The parent statement of the instruction - void buildAccessSingleDim(MemAccInst Inst, ScopStmt *Stmt); + /// + /// @returns True if the access could be built, False otherwise. + bool buildAccessSingleDim(MemAccInst Inst, ScopStmt *Stmt); /// Finalize all access relations. /// diff --git a/polly/include/polly/ScopDetection.h b/polly/include/polly/ScopDetection.h index dc5036c1ff1f..8fe60d6c50a1 100644 --- a/polly/include/polly/ScopDetection.h +++ b/polly/include/polly/ScopDetection.h @@ -145,6 +145,10 @@ public: AliasSetTracker AST; // The AliasSetTracker to hold the alias information. bool Verifying; // If we are in the verification phase? + /// If this flag is set, the SCoP must eventually be rejected, even with + /// KeepGoing. + bool IsInvalid = false; + /// Container to remember rejection reasons for this region. RejectLog Log; @@ -288,13 +292,13 @@ private: bool hasBaseAffineAccesses(DetectionContext &Context, const SCEVUnknown *BasePointer, Loop *Scope) const; - // 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. + /// 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. bool hasAffineMemoryAccesses(DetectionContext &Context) const; - // Try to expand the region R. If R can be expanded return the expanded - // region, NULL otherwise. + /// Try to expand the region R. If R can be expanded return the expanded + /// region, NULL otherwise. Region *expandRegion(Region &R); /// Find the Scops in this region tree. @@ -305,8 +309,6 @@ private: /// Check if all basic block in the region are valid. /// /// @param Context The context of scop detection. - /// - /// @return True if all blocks in R are valid, false otherwise. bool allBlocksValid(DetectionContext &Context); /// Check if a region has sufficient compute instructions. @@ -348,23 +350,21 @@ private: /// /// @param Context The context of scop detection. /// - /// @return True if R is a Scop, false otherwise. + /// @return If we short-circuited early to not waste time on known-invalid + /// SCoPs. Use Context.IsInvalid to determine whether the region is a + /// valid SCoP. bool isValidRegion(DetectionContext &Context); /// Check if an intrinsic call can be part of a Scop. /// /// @param II The intrinsic call instruction to check. /// @param Context The current detection context. - /// - /// @return True if the call instruction is valid, false otherwise. bool isValidIntrinsicInst(IntrinsicInst &II, DetectionContext &Context) const; /// Check if a call instruction can be part of a Scop. /// /// @param CI The call instruction to check. /// @param Context The current detection context. - /// - /// @return True if the call instruction is valid, false otherwise. bool isValidCallInst(CallInst &CI, DetectionContext &Context) const; /// Check if the given loads could be invariant and can be hoisted. @@ -402,16 +402,12 @@ private: /// /// @param Inst The instruction accessing the memory. /// @param Context The context of scop detection. - /// - /// @return True if the memory access is valid, false otherwise. bool isValidMemoryAccess(MemAccInst Inst, DetectionContext &Context) const; /// Check if an instruction can be part of a Scop. /// /// @param Inst The instruction to check. /// @param Context The context of scop detection. - /// - /// @return True if the instruction is valid, false otherwise. bool isValidInstruction(Instruction &Inst, DetectionContext &Context); /// Check if the switch @p SI with condition @p Condition is valid. @@ -421,8 +417,6 @@ private: /// @param Condition The switch condition. /// @param IsLoopBranch Flag to indicate the branch is a loop exit/latch. /// @param Context The context of scop detection. - /// - /// @return True if the branch @p BI is valid. bool isValidSwitch(BasicBlock &BB, SwitchInst *SI, Value *Condition, bool IsLoopBranch, DetectionContext &Context) const; @@ -433,8 +427,6 @@ private: /// @param Condition The branch condition. /// @param IsLoopBranch Flag to indicate the branch is a loop exit/latch. /// @param Context The context of scop detection. - /// - /// @return True if the branch @p BI is valid. bool isValidBranch(BasicBlock &BB, BranchInst *BI, Value *Condition, bool IsLoopBranch, DetectionContext &Context); @@ -459,10 +451,8 @@ private: /// /// @param BB The BB to check the control flow. /// @param IsLoopBranch Flag to indicate the branch is a loop exit/latch. - // @param AllowUnreachable Allow unreachable statements. + /// @param AllowUnreachable Allow unreachable statements. /// @param Context The context of scop detection. - /// - /// @return True if the BB contains only valid control flow. bool isValidCFG(BasicBlock &BB, bool IsLoopBranch, bool AllowUnreachable, DetectionContext &Context); @@ -470,8 +460,6 @@ private: /// /// @param L The loop to check. /// @param Context The context of scop detection. - /// - /// @return True if the loop is valid in the region. bool isValidLoop(Loop *L, DetectionContext &Context); /// Count the number of loops and the maximal loop depth in @p L. diff --git a/polly/include/polly/Support/ScopHelper.h b/polly/include/polly/Support/ScopHelper.h index 6bfbebac7e2d..dc255e4f82d9 100644 --- a/polly/include/polly/Support/ScopHelper.h +++ b/polly/include/polly/Support/ScopHelper.h @@ -303,7 +303,6 @@ public: llvm::Instruction *asInstruction() const { return I; } -private: bool isLoad() const { return I && llvm::isa<llvm::LoadInst>(I); } bool isStore() const { return I && llvm::isa<llvm::StoreInst>(I); } bool isCallInst() const { return I && llvm::isa<llvm::CallInst>(I); } |