summaryrefslogtreecommitdiffstats
path: root/polly/lib/Support/ScopHelper.cpp
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2015-11-11 13:25:13 +0000
committerTobias Grosser <tobias@grosser.es>2015-11-11 13:25:13 +0000
commite3d1f1c0b032dd5833530ac0ccf2c4f8beb1f1d0 (patch)
tree957353898dcf255b96aa1efce1ce0a3bc162583b /polly/lib/Support/ScopHelper.cpp
parentb12b006c4ba6c4a363f488e27851eb619e2dd915 (diff)
downloadbcm5719-llvm-e3d1f1c0b032dd5833530ac0ccf2c4f8beb1f1d0.tar.gz
bcm5719-llvm-e3d1f1c0b032dd5833530ac0ccf2c4f8beb1f1d0.zip
ScopDetection: Tighten the check for always executed 'error blocks'
Basic blocks that are always executed can not be error blocks as their execution can not possibly be an unlikely event. In this commit we tighten the check if an error block to basic blcoks that do not dominate the exit condition, but that dominate all exiting blocks of the scop. llvm-svn: 252726
Diffstat (limited to 'polly/lib/Support/ScopHelper.cpp')
-rw-r--r--polly/lib/Support/ScopHelper.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/polly/lib/Support/ScopHelper.cpp b/polly/lib/Support/ScopHelper.cpp
index 49e1e9eab17..777eb9b518a 100644
--- a/polly/lib/Support/ScopHelper.cpp
+++ b/polly/lib/Support/ScopHelper.cpp
@@ -352,7 +352,14 @@ bool polly::isErrorBlock(BasicBlock &BB, const Region &R, LoopInfo &LI,
if (LI.isLoopHeader(&BB))
return false;
- if (DT.dominates(&BB, R.getExit()))
+ // Basic blocks that are always executed are not considered error blocks,
+ // as their execution can not be a rare event.
+ bool DominatesAllPredecessors = true;
+ for (auto Pred : predecessors(R.getExit()))
+ if (R.contains(Pred) && !DT.dominates(&BB, Pred))
+ DominatesAllPredecessors = false;
+
+ if (DominatesAllPredecessors)
return false;
// FIXME: This is a simple heuristic to determine if the load is executed
OpenPOWER on IntegriCloud