diff options
| author | Philip Pfaffe <philip.pfaffe@gmail.com> | 2017-11-30 13:06:10 +0000 |
|---|---|---|
| committer | Philip Pfaffe <philip.pfaffe@gmail.com> | 2017-11-30 13:06:10 +0000 |
| commit | 4fe21814d151bcf6bfff96f6bf9d66cbd71f0332 (patch) | |
| tree | e78bb85268c828e634c16ad8d5f0d7a3bbac144d /polly/lib | |
| parent | a6bcd53d5229db563d0ba25b6385e3ca5d0820de (diff) | |
| download | bcm5719-llvm-4fe21814d151bcf6bfff96f6bf9d66cbd71f0332.tar.gz bcm5719-llvm-4fe21814d151bcf6bfff96f6bf9d66cbd71f0332.zip | |
Handle Top-Level-Regions in polly::isHoistableLoad
Summary:
This can be seen as a follow-up on my previous differential [D33411](https://reviews.llvm.org/D33411).
We received a bug report where this error was triggered. I have tried my best to recreate the issue in a minimal lit testcase which is also part of this differential.
I only handle return instructions as predecessors to a virtual TLR-exit right now. From inspecting the codebase, it seems `unreachable` instructions may also be of interest here. If requested, I can extend my patches to consider them as well. I would also apply this on `ScopHelper.cpp::isErrorBlock` (see D33411), of course.
Reviewers: philip.pfaffe, bollu
Reviewed By: bollu
Subscribers: Meinersbur, pollydev, llvm-commits
Tags: #polly
Differential Revision: https://reviews.llvm.org/D40492
llvm-svn: 319431
Diffstat (limited to 'polly/lib')
| -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; |

