[NFC] Refactor assumption tracking interface

llvm-svn: 271890
This commit is contained in:
Johannes Doerfert 2016-06-06 12:16:10 +00:00
parent 6a6a671c72
commit 1a6b0f7f07
2 changed files with 28 additions and 15 deletions

View File

@ -1942,6 +1942,15 @@ public:
/// @returns True if the optimized SCoP can be executed.
bool hasFeasibleRuntimeContext() const;
/// @brief Check if the assumption in @p Set is trivial or not.
///
/// @param Set The relations between parameters that are assumed to hold.
/// @param Sign Enum to indicate if the assumptions in @p Set are positive
/// (needed/assumptions) or negative (invalid/restrictions).
///
/// @returns True if the assumption @p Set is not trivial.
bool isEffectiveAssumption(__isl_keep isl_set *Set, AssumptionSign Sign);
/// @brief Track and report an assumption.
///
/// Use 'clang -Rpass-analysis=polly-scops' or 'opt

View File

@ -3678,23 +3678,27 @@ static std::string toString(AssumptionKind Kind) {
llvm_unreachable("Unknown AssumptionKind!");
}
bool Scop::isEffectiveAssumption(__isl_keep isl_set *Set, AssumptionSign Sign) {
if (Sign == AS_ASSUMPTION) {
if (isl_set_is_subset(Context, Set))
return false;
if (isl_set_is_subset(AssumedContext, Set))
return false;
} else {
if (isl_set_is_disjoint(Set, Context))
return false;
if (isl_set_is_subset(Set, InvalidContext))
return false;
}
return true;
}
bool Scop::trackAssumption(AssumptionKind Kind, __isl_keep isl_set *Set,
DebugLoc Loc, AssumptionSign Sign) {
if (PollyRemarksMinimal) {
if (Sign == AS_ASSUMPTION) {
if (isl_set_is_subset(Context, Set))
return false;
if (isl_set_is_subset(AssumedContext, Set))
return false;
} else {
if (isl_set_is_disjoint(Set, Context))
return false;
if (isl_set_is_subset(Set, InvalidContext))
return false;
}
}
if (PollyRemarksMinimal && !isEffectiveAssumption(Set, Sign))
return false;
auto &F = getFunction();
auto Suffix = Sign == AS_ASSUMPTION ? " assumption:\t" : " restriction:\t";