diff options
Diffstat (limited to 'polly/lib/Support/ScopHelper.cpp')
| -rw-r--r-- | polly/lib/Support/ScopHelper.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/polly/lib/Support/ScopHelper.cpp b/polly/lib/Support/ScopHelper.cpp index ac501113d8d..87ac658a79d 100644 --- a/polly/lib/Support/ScopHelper.cpp +++ b/polly/lib/Support/ScopHelper.cpp @@ -473,9 +473,15 @@ bool polly::isHoistableLoad(LoadInst *LInst, Region &R, LoopInfo &LI, return false; bool DominatesAllPredecessors = true; - for (auto Pred : predecessors(R.getExit())) - if (R.contains(Pred) && !DT.dominates(&BB, Pred)) - DominatesAllPredecessors = false; + if (R.isTopLevelRegion()) { + for (BasicBlock &I : *R.getEntry()->getParent()) + if (isa<ReturnInst>(I.getTerminator()) && !DT.dominates(&BB, &I)) + DominatesAllPredecessors = false; + } else { + for (auto Pred : predecessors(R.getExit())) + if (R.contains(Pred) && !DT.dominates(&BB, Pred)) + DominatesAllPredecessors = false; + } if (!DominatesAllPredecessors) continue; |

