From: Bill Wendling Date: Fri, 2 May 2008 00:43:20 +0000 (+0000) Subject: Porting r50563 from Tak to mainline. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=643310da6d6a9e8cb64575246483f63897fbbcf4;p=oota-llvm.git Porting r50563 from Tak to mainline. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50564 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp index da6f076a9a6..a6bd9ff20a9 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,