aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2012-03-09 18:50:52 +0000
committerDan Gohman <gohman@apple.com>2012-03-09 18:50:52 +0000
commit5992f67e683b665392f45b167fe5c9abd91455c9 (patch)
tree9a03ff43849e50ea3b5d53a2712cdbf93617ef86 /lib
parentfaf72ffda3bf83b08769428129ee4755787ee6cf (diff)
downloadexternal_llvm-5992f67e683b665392f45b167fe5c9abd91455c9.zip
external_llvm-5992f67e683b665392f45b167fe5c9abd91455c9.tar.gz
external_llvm-5992f67e683b665392f45b167fe5c9abd91455c9.tar.bz2
When identifying exit nodes for the reverse-CFG reverse-post-order
traversal, consider nodes for which the only successors are backedges which the traversal is ignoring to be exit nodes. This fixes a problem where the bottom-up traversal was failing to visit split blocks along split loop backedges. This fixes rdar://10989035. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152421 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/ObjCARC.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/ObjCARC.cpp b/lib/Transforms/Scalar/ObjCARC.cpp
index 1c7f036..91dc23c 100644
--- a/lib/Transforms/Scalar/ObjCARC.cpp
+++ b/lib/Transforms/Scalar/ObjCARC.cpp
@@ -2929,11 +2929,17 @@ ComputePostOrders(Function &F,
Visited.clear();
// Compute the exits, which are the starting points for reverse-CFG DFS.
+ // This includes blocks where all the successors are backedges that
+ // we're skipping.
SmallVector<BasicBlock *, 4> Exits;
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
BasicBlock *BB = I;
- if (cast<TerminatorInst>(&BB->back())->getNumSuccessors() == 0)
- Exits.push_back(BB);
+ TerminatorInst *TI = cast<TerminatorInst>(&BB->back());
+ for (succ_iterator SI(TI), SE(TI, true); SI != SE; ++SI)
+ if (!Backedges.count(std::make_pair(BB, *SI)))
+ goto HasNonBackedgeSucc;
+ Exits.push_back(BB);
+ HasNonBackedgeSucc:;
}
// Do reverse-CFG DFS, computing the reverse-CFG PostOrder.