summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorGerolf Hoflehner <ghoflehner@apple.com>2017-07-12 23:05:15 +0000
committerGerolf Hoflehner <ghoflehner@apple.com>2017-07-12 23:05:15 +0000
commit3f164318e77bb1accbde6b79efb427cce7553b4c (patch)
tree4d5b2bcf0fdda1370bebc49350c759a1682fdacb /llvm/lib
parentac298951731bab2aceafd6f7f42ec1c0863316f4 (diff)
downloadbcm5719-llvm-3f164318e77bb1accbde6b79efb427cce7553b4c.tar.gz
bcm5719-llvm-3f164318e77bb1accbde6b79efb427cce7553b4c.zip
[SjLj] Replace recursive block marking algorithm with iterative algorithm
Summary: Some programs run into a stack overflow issue. This change avoids this problem by replacing the recursive algorithm with the iterative version. Reviewers: MatzeB, t.p.northover, dblaikie Reviewed By: MatzeB Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35105 llvm-svn: 307860
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SjLjEHPrepare.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SjLjEHPrepare.cpp b/llvm/lib/CodeGen/SjLjEHPrepare.cpp
index 7886737b879..17a3a84ecda 100644
--- a/llvm/lib/CodeGen/SjLjEHPrepare.cpp
+++ b/llvm/lib/CodeGen/SjLjEHPrepare.cpp
@@ -125,8 +125,11 @@ static void MarkBlocksLiveIn(BasicBlock *BB,
if (!LiveBBs.insert(BB).second)
return; // already been here.
- for (BasicBlock *PredBB : predecessors(BB))
- MarkBlocksLiveIn(PredBB, LiveBBs);
+ df_iterator_default_set<BasicBlock*> Visited;
+
+ for (BasicBlock *B : inverse_depth_first_ext(BB, Visited))
+ LiveBBs.insert(B);
+
}
/// substituteLPadValues - Substitute the values returned by the landingpad
OpenPOWER on IntegriCloud