summaryrefslogtreecommitdiffstats
path: root/polly/include
diff options
context:
space:
mode:
authorDominik Adamski <adamski.dominik@gmail.com>2019-08-06 21:25:35 +0000
committerDominik Adamski <adamski.dominik@gmail.com>2019-08-06 21:25:35 +0000
commitb169e58b31463075d6e0990c7c8d3e63eefe2059 (patch)
tree30c5a3f4dc959b16fd106238315fb1efb2d945a9 /polly/include
parent956892433f7c0ae4520232b07d442fedbcc14cb2 (diff)
downloadbcm5719-llvm-b169e58b31463075d6e0990c7c8d3e63eefe2059.tar.gz
bcm5719-llvm-b169e58b31463075d6e0990c7c8d3e63eefe2059.zip
[NFC][ScopBuilder] Move addUserAssumptions to ScopBuilder
Scope of changes: 1) Moved addUserAssumptions function to ScopBuilder class. 2) Moved buildConditionSets functions to polly namespace. 3) Moved getRepresentingInvariantLoadSCEV to public section of the Scop class Differential Revision: https://reviews.llvm.org/D65241 llvm-svn: 368089
Diffstat (limited to 'polly/include')
-rw-r--r--polly/include/polly/ScopBuilder.h4
-rw-r--r--polly/include/polly/ScopInfo.h71
2 files changed, 58 insertions, 17 deletions
diff --git a/polly/include/polly/ScopBuilder.h b/polly/include/polly/ScopBuilder.h
index 415190b5dfd..5a525cdc191 100644
--- a/polly/include/polly/ScopBuilder.h
+++ b/polly/include/polly/ScopBuilder.h
@@ -442,6 +442,10 @@ class ScopBuilder {
/// Add user provided parameter constraints to context (command line).
void addUserContext();
+ /// Add user provided parameter constraints to context (source code).
+ void addUserAssumptions(AssumptionCache &AC,
+ DenseMap<BasicBlock *, isl::set> &InvalidDomainMap);
+
/// Add all recorded assumptions to the assumed context.
void addRecordedAssumptions();
diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h
index 9405d8c26c6..b63d271ae16 100644
--- a/polly/include/polly/ScopInfo.h
+++ b/polly/include/polly/ScopInfo.h
@@ -1642,6 +1642,44 @@ struct Assumption {
BasicBlock *BB;
};
+/// Build the conditions sets for the branch condition @p Condition in
+/// the @p Domain.
+///
+/// This will fill @p ConditionSets with the conditions under which control
+/// will be moved from @p TI to its successors. Hence, @p ConditionSets will
+/// have as many elements as @p TI has successors. If @p TI is nullptr the
+/// context under which @p Condition is true/false will be returned as the
+/// new elements of @p ConditionSets.
+bool buildConditionSets(Scop &S, BasicBlock *BB, Value *Condition,
+ Instruction *TI, Loop *L, __isl_keep isl_set *Domain,
+ DenseMap<BasicBlock *, isl::set> &InvalidDomainMap,
+ SmallVectorImpl<__isl_give isl_set *> &ConditionSets);
+
+/// Build condition sets for unsigned ICmpInst(s).
+/// Special handling is required for unsigned operands to ensure that if
+/// MSB (aka the Sign bit) is set for an operands in an unsigned ICmpInst
+/// it should wrap around.
+///
+/// @param IsStrictUpperBound holds information on the predicate relation
+/// between TestVal and UpperBound, i.e,
+/// TestVal < UpperBound OR TestVal <= UpperBound
+__isl_give isl_set *
+buildUnsignedConditionSets(Scop &S, BasicBlock *BB, Value *Condition,
+ __isl_keep isl_set *Domain, const SCEV *SCEV_TestVal,
+ const SCEV *SCEV_UpperBound,
+ DenseMap<BasicBlock *, isl::set> &InvalidDomainMap,
+ bool IsStrictUpperBound);
+
+/// Build the conditions sets for the terminator @p TI in the @p Domain.
+///
+/// This will fill @p ConditionSets with the conditions under which control
+/// will be moved from @p TI to its successors. Hence, @p ConditionSets will
+/// have as many elements as @p TI has successors.
+bool buildConditionSets(Scop &S, BasicBlock *BB, Instruction *TI, Loop *L,
+ __isl_keep isl_set *Domain,
+ DenseMap<BasicBlock *, isl::set> &InvalidDomainMap,
+ SmallVectorImpl<__isl_give isl_set *> &ConditionSets);
+
/// Static Control Part
///
/// A Scop is the polyhedral representation of a control flow region detected
@@ -2040,29 +2078,12 @@ private:
/// Build the Context of the Scop.
void buildContext();
- /// Add user provided parameter constraints to context (source code).
- void addUserAssumptions(AssumptionCache &AC, DominatorTree &DT, LoopInfo &LI,
- DenseMap<BasicBlock *, isl::set> &InvalidDomainMap);
-
/// Add the bounds of the parameters to the context.
void addParameterBounds();
/// Simplify the assumed and invalid context.
void simplifyContexts();
- /// Get the representing SCEV for @p S if applicable, otherwise @p S.
- ///
- /// Invariant loads of the same location are put in an equivalence class and
- /// only one of them is chosen as a representing element that will be
- /// modeled as a parameter. The others have to be normalized, i.e.,
- /// replaced by the representing element of their equivalence class, in order
- /// to get the correct parameter value, e.g., in the SCEVAffinator.
- ///
- /// @param S The SCEV to normalize.
- ///
- /// @return The representing SCEV for invariant loads or @p S if none.
- const SCEV *getRepresentingInvariantLoadSCEV(const SCEV *S) const;
-
/// Create a new SCoP statement for @p BB.
///
/// A new statement for @p BB will be created and added to the statement
@@ -2205,6 +2226,9 @@ public:
/// @return The count of parameters used in this Scop.
size_t getNumParams() const { return Parameters.size(); }
+ /// Return whether given SCEV is used as the parameter in this Scop.
+ bool isParam(const SCEV *Param) const { return Parameters.count(Param); }
+
/// Take a list of parameters and add the new ones to the scop.
void addParams(const ParameterSetTy &NewParameters);
@@ -2769,6 +2793,19 @@ public:
/// statement.
long getNextStmtIdx() { return StmtIdx++; }
+ /// Get the representing SCEV for @p S if applicable, otherwise @p S.
+ ///
+ /// Invariant loads of the same location are put in an equivalence class and
+ /// only one of them is chosen as a representing element that will be
+ /// modeled as a parameter. The others have to be normalized, i.e.,
+ /// replaced by the representing element of their equivalence class, in order
+ /// to get the correct parameter value, e.g., in the SCEVAffinator.
+ ///
+ /// @param S The SCEV to normalize.
+ ///
+ /// @return The representing SCEV for invariant loads or @p S if none.
+ const SCEV *getRepresentingInvariantLoadSCEV(const SCEV *S) const;
+
/// Return the MemoryAccess that writes an llvm::Value, represented by a
/// ScopArrayInfo.
///
OpenPOWER on IntegriCloud