[llvm] 871d03a - [FunctionAttrs] Inline setDoesNotRecurse() and delete it. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 19 22:25:26 PDT 2020


Author: Fangrui Song
Date: 2020-09-19T22:24:52-07:00
New Revision: 871d03a6751e0f82e210c80a881ef357c5633a26

URL: https://github.com/llvm/llvm-project/commit/871d03a6751e0f82e210c80a881ef357c5633a26
DIFF: https://github.com/llvm/llvm-project/commit/871d03a6751e0f82e210c80a881ef357c5633a26.diff

LOG: [FunctionAttrs] Inline setDoesNotRecurse() and delete it. NFC

It always returns true, which may lead to confusion. Inline it because it is
trivial and only called twice.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/FunctionAttrs.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index 293c73a01480..2e5d9095989e 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -1345,12 +1345,6 @@ static bool inferAttrsFromFunctionBodies(const SCCNodeSet &SCCNodes) {
   return AI.run(SCCNodes);
 }
 
-static bool setDoesNotRecurse(Function &F) {
-  F.setDoesNotRecurse();
-  ++NumNoRecurse;
-  return true;
-}
-
 static bool addNoRecurseAttrs(const SCCNodeSet &SCCNodes) {
   // Try and identify functions that do not recurse.
 
@@ -1377,7 +1371,9 @@ static bool addNoRecurseAttrs(const SCCNodeSet &SCCNodes) {
   // Every call was to a non-recursive function other than this function, and
   // we have no indirect recursion as the SCC size is one. This function cannot
   // recurse.
-  return setDoesNotRecurse(*F);
+  F->setDoesNotRecurse();
+  ++NumNoRecurse;
+  return true;
 }
 
 template <typename AARGetterT>
@@ -1580,7 +1576,9 @@ static bool addNoRecurseAttrsTopDown(Function &F) {
     if (!CB || !CB->getParent()->getParent()->doesNotRecurse())
       return false;
   }
-  return setDoesNotRecurse(F);
+  F.setDoesNotRecurse();
+  ++NumNoRecurse;
+  return true;
 }
 
 static bool deduceFunctionAttributeInRPO(Module &M, CallGraph &CG) {


        


More information about the llvm-commits mailing list