aboutsummaryrefslogtreecommitdiff
path: root/polly/include
diff options
context:
space:
mode:
authorDominik Adamski <adamski.dominik@gmail.com>2019-07-16 20:51:04 +0000
committerDominik Adamski <adamski.dominik@gmail.com>2019-07-16 20:51:04 +0000
commitddbb83732afc2e392eca5873910b5424a069e656 (patch)
tree0306ed5a764866cecee3ed17fe47726e0ac804c0 /polly/include
parent12154ee8f1ee170bac97ef238dece50d504de08a (diff)
downloadllvm-project-ddbb83732afc2e392eca5873910b5424a069e656.tar.gz
[NFC][ScopBuilder] Move addRecordedAssumption to ScopBuilder
Scope of changes: 1) Moved addRecordedAssumptions to ScopBuilder. 2) Moved Assumption struct outside Scop class. 3) Refactored addRecordedAssumptions function. Replaced while loop by for range loop. 4) Added function to clear processed Assumptions. Differential Revision: https://reviews.llvm.org/D63572 llvm-svn: 366260
Diffstat (limited to 'polly/include')
-rw-r--r--polly/include/polly/ScopBuilder.h3
-rw-r--r--polly/include/polly/ScopInfo.h51
2 files changed, 32 insertions, 22 deletions
diff --git a/polly/include/polly/ScopBuilder.h b/polly/include/polly/ScopBuilder.h
index bc0007009c6e..9cfdf7b3cbf4 100644
--- a/polly/include/polly/ScopBuilder.h
+++ b/polly/include/polly/ScopBuilder.h
@@ -327,6 +327,9 @@ class ScopBuilder {
BasicBlock *IncomingBlock, Value *IncomingValue,
bool IsExitBlock);
+ /// Add all recorded assumptions to the assumed context.
+ void addRecordedAssumptions();
+
/// Create a MemoryAccess for reading the value of a phi.
///
/// The modeling assumes that all incoming blocks write their incoming value
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h
index aeed4a7e3d4f..30e8d0346ad5 100644
--- a/polly/include/polly/ScopInfo.h
+++ b/polly/include/polly/ScopInfo.h
@@ -1624,6 +1624,24 @@ public:
/// Print ScopStmt S to raw_ostream OS.
raw_ostream &operator<<(raw_ostream &OS, const ScopStmt &S);
+/// Helper struct to remember assumptions.
+struct Assumption {
+ /// The kind of the assumption (e.g., WRAPPING).
+ AssumptionKind Kind;
+
+ /// Flag to distinguish assumptions and restrictions.
+ AssumptionSign Sign;
+
+ /// The valid/invalid context if this is an assumption/restriction.
+ isl::set Set;
+
+ /// The location that caused this assumption.
+ DebugLoc Loc;
+
+ /// An optional block whose domain can simplify the assumption.
+ BasicBlock *BB;
+};
+
/// Static Control Part
///
/// A Scop is the polyhedral representation of a control flow region detected
@@ -1782,24 +1800,7 @@ private:
/// need to be "false". Otherwise they behave the same.
isl::set InvalidContext;
- /// Helper struct to remember assumptions.
- struct Assumption {
- /// The kind of the assumption (e.g., WRAPPING).
- AssumptionKind Kind;
-
- /// Flag to distinguish assumptions and restrictions.
- AssumptionSign Sign;
-
- /// The valid/invalid context if this is an assumption/restriction.
- isl::set Set;
-
- /// The location that caused this assumption.
- DebugLoc Loc;
-
- /// An optional block whose domain can simplify the assumption.
- BasicBlock *BB;
- };
-
+ using RecordedAssumptionsTy = SmallVector<Assumption, 8>;
/// Collection to hold taken assumptions.
///
/// There are two reasons why we want to record assumptions first before we
@@ -1810,7 +1811,7 @@ private:
/// construction (basically after we know all parameters), thus the user
/// might see overly complicated assumptions to be taken while they will
/// only be simplified later on.
- SmallVector<Assumption, 8> RecordedAssumptions;
+ RecordedAssumptionsTy RecordedAssumptions;
/// The schedule of the SCoP
///
@@ -2338,6 +2339,12 @@ public:
InvariantEquivClasses.end());
}
+ /// Return an iterator range containing hold assumptions.
+ iterator_range<RecordedAssumptionsTy::const_iterator>
+ recorded_assumptions() const {
+ return make_range(RecordedAssumptions.begin(), RecordedAssumptions.end());
+ }
+
/// Return whether this scop is empty, i.e. contains no statements that
/// could be executed.
bool isEmpty() const { return Stmts.empty(); }
@@ -2494,6 +2501,9 @@ public:
/// @returns True if the optimized SCoP can be executed.
bool hasFeasibleRuntimeContext() const;
+ /// Clear assumptions which have been already processed.
+ void clearRecordedAssumptions() { return RecordedAssumptions.clear(); }
+
/// Check if the assumption in @p Set is trivial or not.
///
/// @param Set The relations between parameters that are assumed to hold.
@@ -2559,9 +2569,6 @@ public:
void recordAssumption(AssumptionKind Kind, isl::set Set, DebugLoc Loc,
AssumptionSign Sign, BasicBlock *BB = nullptr);
- /// Add all recorded assumptions to the assumed context.
- void addRecordedAssumptions();
-
/// Mark the scop as invalid.
///
/// This method adds an assumption to the scop that is always invalid. As a