[polly] r249151 - Bail-out early if all statements have been simplified away
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 09:33:28 PDT 2015
Author: meinersbur
Date: Fri Oct 2 11:33:27 2015
New Revision: 249151
URL: http://llvm.org/viewvc/llvm-project?rev=249151&view=rev
Log:
Bail-out early if all statements have been simplified away
Treat the scop as invalid instead of creating dummy domains.
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=249151&r1=249150&r2=249151&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Fri Oct 2 11:33:27 2015
@@ -1302,6 +1302,10 @@ public:
int getNumArrays() { return ScopArrayInfoMap.size(); }
+ /// @brief Return whether this scop is empty, i.e. contains no statements that
+ /// could be executed.
+ bool isEmpty() const { return Stmts.empty(); }
+
typedef iterator_range<ArrayInfoMapTy::iterator> array_range;
typedef iterator_range<ArrayInfoMapTy::const_iterator> const_array_range;
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=249151&r1=249150&r2=249151&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Fri Oct 2 11:33:27 2015
@@ -2302,15 +2302,19 @@ Scop::Scop(Region &R, AccFuncMapType &Ac
isl_ctx *Context, unsigned MaxLoopDepth)
: DT(DT), SE(&ScalarEvolution), SD(SD), R(R), AccFuncMap(AccFuncMap),
IsOptimized(false), HasSingleExitEdge(R.getExitingBlock()),
- MaxLoopDepth(MaxLoopDepth), IslCtx(Context), Affinator(this),
- BoundaryContext(nullptr) {}
+ MaxLoopDepth(MaxLoopDepth), IslCtx(Context), Context(nullptr),
+ Affinator(this), AssumedContext(nullptr), BoundaryContext(nullptr),
+ Schedule(nullptr) {}
void Scop::init(LoopInfo &LI, AliasAnalysis &AA) {
buildContext();
buildDomains(&R, LI, DT);
// Remove empty and ignored statements.
+ // Exit early in case there are no executable statements left in this scop.
simplifySCoP(true);
+ if (Stmts.empty())
+ return;
// The ScopStmts now have enough information to initialize themselves.
for (ScopStmt &Stmt : Stmts)
@@ -2889,15 +2893,7 @@ void Scop::buildSchedule(
Loop *L = getLoopSurroundingRegion(*R, LI);
auto &LSchedulePair = LoopSchedules[L];
ScopStmt *Stmt = getStmtForBasicBlock(R->getEntry());
- isl_set *Domain;
- if (Stmt) {
- Domain = Stmt->getDomain();
- } else {
- // This case happens when the SCoP consists of only one non-affine region
- // which doesn't contain any accesses and has hence been optimized away.
- // We use a dummy domain for this case.
- Domain = isl_set_empty(isl_space_set_alloc(IslCtx, 0, 0));
- }
+ isl_set *Domain = Stmt->getDomain();
auto *UDomain = isl_union_set_from_set(Domain);
auto *StmtSchedule = isl_schedule_from_domain(UDomain);
LSchedulePair.first = StmtSchedule;
@@ -3407,7 +3403,7 @@ bool ScopInfo::runOnRegion(Region *R, RG
DEBUG(scop->print(dbgs()));
- if (!scop->hasFeasibleRuntimeContext()) {
+ if (scop->isEmpty() || !scop->hasFeasibleRuntimeContext()) {
delete scop;
scop = nullptr;
return false;
More information about the llvm-commits
mailing list