[llvm] r251728 - [FunctionAttrs] Inline the prototype attribute inference to an existing

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 30 17:28:38 PDT 2015


Author: chandlerc
Date: Fri Oct 30 19:28:37 2015
New Revision: 251728

URL: http://llvm.org/viewvc/llvm-project?rev=251728&view=rev
Log:
[FunctionAttrs] Inline the prototype attribute inference to an existing
loop over the SCC.

The separate function wasn't really adding much, NFC.

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

Modified: llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp?rev=251728&r1=251727&r2=251728&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp Fri Oct 30 19:28:37 2015
@@ -73,8 +73,6 @@ struct FunctionAttrs : public CallGraphS
 
 private:
   TargetLibraryInfo *TLI;
-
-  bool annotateLibraryCalls(const CallGraphSCC &SCC);
 };
 }
 
@@ -1750,27 +1748,9 @@ static bool inferPrototypeAttributes(Fun
   return true;
 }
 
-/// Adds attributes to well-known standard library call declarations.
-bool FunctionAttrs::annotateLibraryCalls(const CallGraphSCC &SCC) {
-  bool MadeChange = false;
-
-  // Check each function in turn annotating well-known library function
-  // declarations with attributes.
-  for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) {
-    Function *F = (*I)->getFunction();
-
-    if (F && F->isDeclaration())
-      MadeChange |= inferPrototypeAttributes(*F, *TLI);
-  }
-
-  return MadeChange;
-}
-
 bool FunctionAttrs::runOnSCC(CallGraphSCC &SCC) {
   TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
-
-  // Annotate declarations for which we have special knowledge.
-  bool Changed = annotateLibraryCalls(SCC);
+  bool Changed = false;
 
   // We compute dedicated AA results for each function in the SCC as needed. We
   // use a lambda referencing external objects so that they live long enough to
@@ -1798,6 +1778,11 @@ bool FunctionAttrs::runOnSCC(CallGraphSC
       continue;
     }
 
+    // When initially processing functions, also infer their prototype
+    // attributes if they are declarations.
+    if (F->isDeclaration())
+      Changed |= inferPrototypeAttributes(*F, *TLI);
+
     SCCNodes.insert(F);
   }
 




More information about the llvm-commits mailing list