[PATCH] D74691: [Attributor] Detect possibly unbounded cycles in functions
omar ahmed via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 25 11:05:55 PST 2020
omarahmed marked an inline comment as done.
omarahmed added a comment.
bool containsCycle(BasicBlock *BB, SmallPtrSet<BasicBlock *, 32> &Visited, SmallPtrSet<BasicBlock *, 32> &Processed) {
if (Processed.count(BB)) {
Visited.erase(BB);
return false;
}
Processed.insert(BB);
Visited.insert(BB);
for (auto *SuccBB : successors(BB)) {
if (!Processed.count(SuccBB) && containsCycle(SuccBB, Visited, Processed))
return true;
else if (Visited.count(SuccBB))
return true;
}
Visited.erase(BB);
return false;
}
what i get is that we will implement dfs by our hand to detect SCCs so can't we use stack method in dfs that will provide us to not split the function into 2 and keep all the logic inside contains cycle
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74691/new/
https://reviews.llvm.org/D74691
More information about the llvm-commits
mailing list