diff options
| author | Devang Patel <dpatel@apple.com> | 2009-03-02 23:39:14 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2009-03-02 23:39:14 +0000 |
| commit | d50ebbdf3f7dbd1c2bb5712d47121cd9a4769c58 (patch) | |
| tree | 6be2024cb3fc009653e7557d7f5f22f3644b4d09 /llvm/lib | |
| parent | 85cefe85671abd5c25f6547ff9914e1e3712bad8 (diff) | |
| download | bcm5719-llvm-d50ebbdf3f7dbd1c2bb5712d47121cd9a4769c58.tar.gz bcm5719-llvm-d50ebbdf3f7dbd1c2bb5712d47121cd9a4769c58.zip | |
If branch conditions' one successor is dominating another non-latch successor then this loop's iteration space can not be restricted. In this example block bb5 is always executed.
llvm-svn: 65902
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp b/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp index 6311e171e0d..e93d448cc1b 100644 --- a/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -532,6 +532,21 @@ bool LoopIndexSplit::updateLoopIterationSpace() { BasicBlock *ExitingBlock = ExitCondition->getParent(); if (!cleanBlock(ExitingBlock)) return false; + // If the merge point for BR is not loop latch then skip this loop. + if (BR->getSuccessor(0) != Latch) { + DominanceFrontier::iterator DF0 = DF->find(BR->getSuccessor(0)); + assert (DF0 != DF->end() && "Unable to find dominance frontier"); + if (!DF0->second.count(Latch)) + return false; + } + + if (BR->getSuccessor(1) != Latch) { + DominanceFrontier::iterator DF1 = DF->find(BR->getSuccessor(1)); + assert (DF1 != DF->end() && "Unable to find dominance frontier"); + if (!DF1->second.count(Latch)) + return false; + } + // Verify that loop exiting block has only two predecessor, where one pred // is split condition block. The other predecessor will become exiting block's // dominator after CFG is updated. TODO : Handle CFG's where exiting block has |

