diff options
author | Devang Patel <dpatel@apple.com> | 2007-09-19 00:15:16 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-09-19 00:15:16 +0000 |
commit | a3057834e214d6e688f84be75738706df9a20885 (patch) | |
tree | 1f489c532fb1f3a5a2392d86f19566bf9b29848f /lib/Transforms | |
parent | 09531c29e5a7629323b31e7df5a4d104e4ac5e02 (diff) | |
download | external_llvm-a3057834e214d6e688f84be75738706df9a20885.zip external_llvm-a3057834e214d6e688f84be75738706df9a20885.tar.gz external_llvm-a3057834e214d6e688f84be75738706df9a20885.tar.bz2 |
Filter loops where split condition's false branch is not empty. For example
for (int i = 0; i < N; ++i) {
if (i == somevalue)
dosomething();
else
dosomethingelse();
}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42121 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/LoopIndexSplit.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp index 92a6058..cb5060a 100644 --- a/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -528,6 +528,10 @@ bool LoopIndexSplit::processOneIterationLoop(SplitInfo &SD) { if (!safeExitingBlock(SD, ExitCondition->getParent())) return false; + // Filter loops where split condition's false branch is not empty. + if (ExitCondition->getParent() != Header->getTerminator()->getSuccessor(1)) + return false; + // If split condition is not safe then do not process this loop. // For example, // for(int i = 0; i < N; i++) { |