[PATCH] D74691: [Attributor] Detect possibly unbounded cycles in functions

Stefanos Baziotis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 15:54:15 PDT 2020


baziotis accepted this revision.
baziotis added a comment.

I added a single nit comment. Otherwise it LGTM! :)



================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:2418-2419
 
-// Helper function that checks whether a function has any cycle.
-// TODO: Replace with more efficent code
-static bool containsCycle(Function &F) {
-  SmallPtrSet<BasicBlock *, 32> Visited;
-
-  // Traverse BB by dfs and check whether successor is already visited.
-  for (BasicBlock *BB : depth_first(&F)) {
-    Visited.insert(BB);
-    for (auto *SuccBB : successors(BB)) {
-      if (Visited.count(SuccBB))
+// Helper function that checks whether a function has any cycle which we don't
+// know is bounded or not.
+// Loops with maximum trip count are considered bounded, any other cycle not.
----------------
[Nit][Grammar] "we don't know is bounded" -> "we don't know if it is bounded"


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