[PATCH] D14228: [FunctionAttrs] Identify norecurse functions
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 4 09:53:50 PST 2015
reames added a subscriber: reames.
================
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:77
@@ -76,2 +76,3 @@
bool AddNonNullAttrs(const CallGraphSCC &SCC);
+ bool AddNoRecurseAttrs(const CallGraphSCC &SCC);
bool annotateLibraryCalls(const CallGraphSCC &SCC);
----------------
It looks like this change needs to be rebased over Chandler's recent ones. Can you update the patch?
================
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:1841
@@ +1840,3 @@
+
+ if (std::any_of(CGN->begin(), CGN->end(),
+ [](const CallGraphNode::CallRecord &CR) {
----------------
If there's a single element in the SCC, why do you need the any_of?
================
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:1849
@@ +1848,3 @@
+
+ F->setDoesNotRecurse();
+ return true;
----------------
The change needs to be conditional on whether the function was already marked recursive. Otherwise, you'll be misleading the wrapping code about changes being made.
================
Comment at: test/Transforms/FunctionAttrs/norecurse.ll:9
@@ +8,3 @@
+; CHECK: define i32 @g() #1
+define i32 @g() {
+ %a = call i32 @g()
----------------
"self_rec" rather than "g"?
================
Comment at: test/Transforms/FunctionAttrs/norecurse.ll:15
@@ +14,3 @@
+; CHECK: define i32 @h() #1
+define i32 @h() {
+ %a = call i32 @i()
----------------
for readability, I'd call these two something like: mutually_rec1 and mutually_rec2
Repository:
rL LLVM
http://reviews.llvm.org/D14228
More information about the llvm-commits
mailing list