[polly] r245593 - Simplify the SCoP creation and bookkeeping
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 20 11:30:09 PDT 2015
Author: jdoerfert
Date: Thu Aug 20 13:30:08 2015
New Revision: 245593
URL: http://llvm.org/viewvc/llvm-project?rev=245593&view=rev
Log:
Simplify the SCoP creation and bookkeeping
To avoid multiple exits and the resulting complicated conditions when
creating a SCoP we now use the single hasFeasibleRuntimeContext()
check to decide if a SCoP should be dismissed right after
construction. If building runtime checks failed the assumed context is
made infeasible, hence the optimized version will never be executed
and the SCoP can be dismissed.
Modified:
polly/trunk/include/polly/ScopInfo.h
polly/trunk/lib/Analysis/ScopInfo.cpp
Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=245593&r1=245592&r2=245593&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Thu Aug 20 13:30:08 2015
@@ -895,13 +895,14 @@ private:
Scop(Region &R, ScalarEvolution &SE, isl_ctx *ctx, unsigned MaxLoopDepth);
/// @brief Initialize this ScopInfo using a TempScop object.
- void initFromTempScop(TempScop &TempScop, LoopInfo &LI, ScopDetection &SD);
+ void initFromTempScop(TempScop &TempScop, LoopInfo &LI, ScopDetection &SD,
+ AliasAnalysis &AA);
/// Create the static control part with a region, max loop depth of this
/// region and parameters used in this region.
static Scop *createFromTempScop(TempScop &TempScop, LoopInfo &LI,
ScalarEvolution &SE, ScopDetection &SD,
- isl_ctx *ctx);
+ AliasAnalysis &AA, isl_ctx *ctx);
/// @brief Check if a basic block is trivial.
///
@@ -1097,6 +1098,9 @@ public:
/// to hold.
void addAssumption(__isl_take isl_set *Set);
+ /// @brief Build the alias checks for this SCoP.
+ void buildAliasChecks(AliasAnalysis &AA);
+
/// @brief Build all alias groups for this SCoP.
///
/// @returns True if __no__ error occurred, false otherwise.
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=245593&r1=245592&r2=245593&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Thu Aug 20 13:30:08 2015
@@ -1346,6 +1346,26 @@ static bool calculateMinMaxAccess(__isl_
return Valid;
}
+void Scop::buildAliasChecks(AliasAnalysis &AA) {
+ if (!PollyUseRuntimeAliasChecks)
+ return;
+
+ if (buildAliasGroups(AA))
+ return;
+
+ // If a problem occurs while building the alias groups we need to delete
+ // this SCoP and pretend it wasn't valid in the first place. To this end
+ // we make the assumed context infeasible.
+ addAssumption(isl_set_empty(getParamSpace()));
+
+ DEBUG(dbgs() << "\n\nNOTE: Run time checks for " << getNameStr()
+ << " could not be created as the number of parameters involved "
+ "is too high. The SCoP will be "
+ "dismissed.\nUse:\n\t--polly-rtc-max-parameters=X\nto adjust "
+ "the maximal number of parameters but be advised that the "
+ "compile time might increase exponentially.\n\n");
+}
+
bool Scop::buildAliasGroups(AliasAnalysis &AA) {
// To create sound alias checks we perform the following steps:
// o) Use the alias analysis and an alias set tracker to build alias sets
@@ -1532,7 +1552,7 @@ Scop::Scop(Region &R, ScalarEvolution &S
MaxLoopDepth(MaxLoopDepth), IslCtx(Context), Affinator(this) {}
void Scop::initFromTempScop(TempScop &TempScop, LoopInfo &LI,
- ScopDetection &SD) {
+ ScopDetection &SD, AliasAnalysis &AA) {
buildContext();
SmallVector<Loop *, 8> NestLoops;
@@ -1547,17 +1567,19 @@ void Scop::initFromTempScop(TempScop &Te
addParameterBounds();
addUserContext();
simplifyAssumedContext();
+ buildAliasChecks(AA);
assert(NestLoops.empty() && "NestLoops not empty at top level!");
}
Scop *Scop::createFromTempScop(TempScop &TempScop, LoopInfo &LI,
ScalarEvolution &SE, ScopDetection &SD,
- isl_ctx *ctx) {
+ AliasAnalysis &AA, isl_ctx *ctx) {
auto &R = TempScop.getMaxRegion();
auto MaxLoopDepth = getMaxLoopDepthInRegion(R, LI, SD);
auto S = new Scop(R, SE, ctx, MaxLoopDepth);
- S->initFromTempScop(TempScop, LI, SD);
+ S->initFromTempScop(TempScop, LI, SD, AA);
+
return S;
}
@@ -2064,7 +2086,7 @@ bool ScopInfo::runOnRegion(Region *R, RG
return false;
}
- scop = Scop::createFromTempScop(*tempScop, LI, SE, SD, ctx);
+ scop = Scop::createFromTempScop(*tempScop, LI, SE, SD, AA, ctx);
DEBUG(scop->print(dbgs()));
@@ -2074,34 +2096,10 @@ bool ScopInfo::runOnRegion(Region *R, RG
return false;
}
- if (!PollyUseRuntimeAliasChecks) {
- // Statistics.
- ++ScopFound;
- if (scop->getMaxLoopDepth() > 0)
- ++RichScopFound;
- return false;
- }
-
- // If a problem occurs while building the alias groups we need to delete
- // this SCoP and pretend it wasn't valid in the first place.
- if (scop->buildAliasGroups(AA)) {
- // Statistics.
- ++ScopFound;
- if (scop->getMaxLoopDepth() > 0)
- ++RichScopFound;
- return false;
- }
-
- DEBUG(dbgs()
- << "\n\nNOTE: Run time checks for " << scop->getNameStr()
- << " could not be created as the number of parameters involved is too "
- "high. The SCoP will be "
- "dismissed.\nUse:\n\t--polly-rtc-max-parameters=X\nto adjust the "
- "maximal number of parameters but be advised that the compile time "
- "might increase exponentially.\n\n");
-
- delete scop;
- scop = nullptr;
+ // Statistics.
+ ++ScopFound;
+ if (scop->getMaxLoopDepth() > 0)
+ ++RichScopFound;
return false;
}
More information about the llvm-commits
mailing list