diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2015-10-31 00:28:37 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2015-10-31 00:28:37 +0000 |
commit | cada2d8d1e613671749db21b137876141a2a326f (patch) | |
tree | b95468fb5ec255bedab296e65f85b6e5d3caaafe /llvm/lib/Transforms | |
parent | 98e6daf1fb3fa2099a84a39d97f7e6958626dc71 (diff) | |
download | bcm5719-llvm-cada2d8d1e613671749db21b137876141a2a326f.tar.gz bcm5719-llvm-cada2d8d1e613671749db21b137876141a2a326f.zip |
[FunctionAttrs] Inline the prototype attribute inference to an existing
loop over the SCC.
The separate function wasn't really adding much, NFC.
llvm-svn: 251728
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/IPO/FunctionAttrs.cpp | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp index 2928cb0bc73..80050220c8b 100644 --- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp +++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp @@ -73,8 +73,6 @@ struct FunctionAttrs : public CallGraphSCCPass { private: TargetLibraryInfo *TLI; - - bool annotateLibraryCalls(const CallGraphSCC &SCC); }; } @@ -1750,27 +1748,9 @@ static bool inferPrototypeAttributes(Function &F, const TargetLibraryInfo &TLI) 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(CallGraphSCC &SCC) { continue; } + // When initially processing functions, also infer their prototype + // attributes if they are declarations. + if (F->isDeclaration()) + Changed |= inferPrototypeAttributes(*F, *TLI); + SCCNodes.insert(F); } |