[NFC] Add flag to disable error block assumptions
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>
Thu, 17 Nov 2016 22:16:35 +0000 (22:16 +0000)
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>
Thu, 17 Nov 2016 22:16:35 +0000 (22:16 +0000)
The declaration as an "error block" is currently aggressive and not very
smart. This patch allows to disable error blocks completely. This might
be useful to prevent SCoP expansion to a point where the assumed context
becomes infeasible, thus the SCoP has to be discarded.

llvm-svn: 287271

polly/lib/Support/ScopHelper.cpp

index 71e788f..7e092fc 100644 (file)
@@ -30,6 +30,11 @@ using namespace polly;
 
 #define DEBUG_TYPE "polly-scop-helper"
 
+static cl::opt<bool> PollyAllowErrorBlocks(
+    "polly-allow-error-blocks",
+    cl::desc("Allow to speculate on the execution of 'error blocks'."),
+    cl::Hidden, cl::init(true), cl::ZeroOrMore, cl::cat(PollyCategory));
+
 bool polly::hasInvokeEdge(const PHINode *PN) {
   for (unsigned i = 0, e = PN->getNumIncomingValues(); i < e; ++i)
     if (InvokeInst *II = dyn_cast<InvokeInst>(PN->getIncomingValue(i)))
@@ -372,6 +377,8 @@ Value *polly::expandCodeFor(Scop &S, ScalarEvolution &SE, const DataLayout &DL,
 
 bool polly::isErrorBlock(BasicBlock &BB, const Region &R, LoopInfo &LI,
                          const DominatorTree &DT) {
+  if (!PollyAllowErrorBlocks)
+    return false;
 
   if (isa<UnreachableInst>(BB.getTerminator()))
     return true;