diff options
author | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2015-09-10 17:51:27 +0000 |
---|---|---|
committer | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2015-09-10 17:51:27 +0000 |
commit | 90db75ed24fdfe533ca0cbfa7771618959a9fd41 (patch) | |
tree | 42eede43fa74b461a3ac262eec9a1f8f4bfc7fcf /polly/lib/Support/ScopHelper.cpp | |
parent | 053701399d42c76fdaff6c16f44494516c046c80 (diff) | |
download | bcm5719-llvm-90db75ed24fdfe533ca0cbfa7771618959a9fd41.tar.gz bcm5719-llvm-90db75ed24fdfe533ca0cbfa7771618959a9fd41.zip |
Runtime error check elimination
Hoist runtime checks in the loop nest if they guard an "error" like event.
Such events are recognized as blocks with an unreachable terminator or a call
to the ubsan function that deals with out of bound accesses. Other "error"
events can be added easily.
We will ignore these blocks when we detect/model/optmize and code generate SCoPs
but we will make sure that they would not have been executed using the assumption
framework.
llvm-svn: 247310
Diffstat (limited to 'polly/lib/Support/ScopHelper.cpp')
-rw-r--r-- | polly/lib/Support/ScopHelper.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/polly/lib/Support/ScopHelper.cpp b/polly/lib/Support/ScopHelper.cpp index a535f98aa55..69904f0c241 100644 --- a/polly/lib/Support/ScopHelper.cpp +++ b/polly/lib/Support/ScopHelper.cpp @@ -331,3 +331,17 @@ Value *polly::expandCodeFor(Scop &S, ScalarEvolution &SE, const DataLayout &DL, ScopExpander Expander(S.getRegion(), SE, DL, Name); return Expander.expandCodeFor(E, Ty, IP); } + +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; + + return false; +} |