summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2008-05-02 00:43:20 +0000
committerBill Wendling <isanbard@gmail.com>2008-05-02 00:43:20 +0000
commit643310da6d6a9e8cb64575246483f63897fbbcf4 (patch)
tree95627bc0c9c6c28b05fbb7abd46c9d1e9b78c220 /lib
parent7ceda160b34f67a0514df9a518da2946e52a04ea (diff)
downloadllvm-643310da6d6a9e8cb64575246483f63897fbbcf4.tar.gz
llvm-643310da6d6a9e8cb64575246483f63897fbbcf4.tar.bz2
llvm-643310da6d6a9e8cb64575246483f63897fbbcf4.tar.xz
Porting r50563 from Tak to mainline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50564 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/LoopIndexSplit.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp
index da6f076a9a..a6bd9ff20a 100644
--- a/lib/Transforms/Scalar/LoopIndexSplit.cpp
+++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp
@@ -1124,6 +1124,11 @@ bool LoopIndexSplit::safeSplitCondition(SplitInfo &SD) {
BasicBlock *Succ0 = SplitTerminator->getSuccessor(0);
BasicBlock *Succ1 = SplitTerminator->getSuccessor(1);
+ // If split block does not dominate the latch then this is not a diamond.
+ // Such loop may not benefit from index split.
+ if (!DT->dominates(SplitCondBlock, Latch))
+ return false;
+
// Finally this split condition is safe only if merge point for
// split condition branch is loop latch. This check along with previous
// check, to ensure that exit condition is in either loop latch or header,