[NFC] Add flag to disable error block assumptions

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
This commit is contained in:
Johannes Doerfert 2016-11-17 22:16:35 +00:00
parent c97654681e
commit 50dfbc572a
1 changed files with 7 additions and 0 deletions

View 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;