diff options
| author | Dan Gohman <gohman@apple.com> | 2012-03-09 18:50:52 +0000 | 
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2012-03-09 18:50:52 +0000 | 
| commit | 500b598c5c04022d6d9f116da3ac64ef1e1ba3eb (patch) | |
| tree | 46fa584f83fe8f5a32ea58a9f4772fbaddbed855 /llvm/lib/Transforms | |
| parent | c8a322a4075c98aff60cc4b8e1daf4186f8e67de (diff) | |
| download | bcm5719-llvm-500b598c5c04022d6d9f116da3ac64ef1e1ba3eb.tar.gz bcm5719-llvm-500b598c5c04022d6d9f116da3ac64ef1e1ba3eb.zip | |
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.
llvm-svn: 152421
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/ObjCARC.cpp | 10 | 
1 files changed, 8 insertions, 2 deletions
| diff --git a/llvm/lib/Transforms/Scalar/ObjCARC.cpp b/llvm/lib/Transforms/Scalar/ObjCARC.cpp index 1c7f036232e..91dc23c56a8 100644 --- a/llvm/lib/Transforms/Scalar/ObjCARC.cpp +++ b/llvm/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. | 

