From 1cd39a4f6e9d7be7de395e5895ea48b3de6a1792 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Mon, 27 Aug 2007 21:34:31 +0000 Subject: [PATCH] Use simpler test to filter loops. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41516 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopIndexSplit.cpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp index d6463f3525b..4a6202e7836 100644 --- a/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -752,21 +752,10 @@ bool LoopIndexSplit::safeSplitCondition(SplitInfo &SD) { && (Latch == Succ0 || Latch == Succ1)) return false; - // If one of the split condition branch is post dominating other then loop - // index split is not appropriate. - if (DT->dominates(Succ0, Latch) || DT->dominates(Succ1, Latch)) + // If split condition branches heads do not have single predecessor, + // SplitCondBlock, then is not possible to remove inactive branch. + if (!Succ0->getSinglePredecessor() || !Succ1->getSinglePredecessor()) return false; - - // If one of the split condition branch is a predecessor of the other - // split condition branch head then do not split loop on this condition. - for(pred_iterator PI = pred_begin(Succ0), PE = pred_end(Succ0); - PI != PE; ++PI) - if (Succ1 == *PI) - return false; - for(pred_iterator PI = pred_begin(Succ1), PE = pred_end(Succ1); - PI != PE; ++PI) - if (Succ0 == *PI) - return false; // Finally this split condition is safe only if merge point for // split condition branch is loop latch. This check along with previous