diff options
Diffstat (limited to 'polly/lib/Support/ScopHelper.cpp')
-rw-r--r-- | polly/lib/Support/ScopHelper.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/polly/lib/Support/ScopHelper.cpp b/polly/lib/Support/ScopHelper.cpp index 9acfed661d8..89c4fa33dca 100644 --- a/polly/lib/Support/ScopHelper.cpp +++ b/polly/lib/Support/ScopHelper.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "polly/Support/ScopHelper.h" +#include "polly/Options.h" #include "polly/ScopInfo.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/LoopInfo.h" @@ -28,6 +29,11 @@ using namespace polly; #define DEBUG_TYPE "polly-scop-helper" +static cl::list<std::string> + ErrorFunctions("polly-error-functions", + cl::desc("A list of error functions"), cl::Hidden, + cl::ZeroOrMore, cl::CommaSeparated, cl::cat(PollyCategory)); + Value *polly::getPointerOperand(Instruction &Inst) { if (LoadInst *load = dyn_cast<LoadInst>(&Inst)) return load->getPointerOperand(); @@ -343,15 +349,21 @@ Value *polly::expandCodeFor(Scop &S, ScalarEvolution &SE, const DataLayout &DL, bool polly::isErrorBlock(BasicBlock &BB) { - for (Instruction &Inst : BB) - if (CallInst *CI = dyn_cast<CallInst>(&Inst)) - if (Function *F = CI->getCalledFunction()) - if (F->getName().equals("__ubsan_handle_out_of_bounds")) - return true; - if (isa<UnreachableInst>(BB.getTerminator())) return true; + if (ErrorFunctions.empty()) + return false; + + for (Instruction &Inst : BB) + if (CallInst *CI = dyn_cast<CallInst>(&Inst)) + if (Function *F = CI->getCalledFunction()) { + const auto &FnName = F->getName(); + for (const auto &ErrorFn : ErrorFunctions) + if (FnName.equals(ErrorFn)) + return true; + } + return false; } |