[PATCH] D14228: [FunctionAttrs] Identify norecurse functions

Manman Ren via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 4 11:44:57 PST 2015


manmanren added a comment.

Thanks for working on it!
Manman


================
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:1832
@@ +1831,3 @@
+  // For a function not to recurse, it must be in its own SCC and must not
+  // call itself or be callable by external functions.
+  if (!SCC.isSingular())
----------------
This comment seems to be incorrect. Should it be "must not call itself or any function that may be recursive"?


================
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:1841
@@ +1840,3 @@
+
+  if (std::any_of(CGN->begin(), CGN->end(),
+                  [](const CallGraphNode::CallRecord &CR) {
----------------
reames wrote:
> If there's a single element in the SCC, why do you need the any_of?
Here it is checking the edges from the single element in the SCC.

================
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:1846
@@ +1845,3 @@
+                  }))
+    // Function calls a potentially recursive function.
+    return false;
----------------
Can you add comments to explain how self-recursion is handled here?


Repository:
  rL LLVM

http://reviews.llvm.org/D14228





More information about the llvm-commits mailing list