summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2015-09-13 08:03:23 +0000
committerChandler Carruth <chandlerc@gmail.com>2015-09-13 08:03:23 +0000
commit444d0056157592b565a2ed7d4632e23420a79a92 (patch)
tree8aeb34570dead3f778acb72e212f6d1ff369cc4b /llvm/lib/Transforms
parentd02452015c7a19264abfb27405cf248254b58d12 (diff)
downloadbcm5719-llvm-444d0056157592b565a2ed7d4632e23420a79a92.tar.gz
bcm5719-llvm-444d0056157592b565a2ed7d4632e23420a79a92.zip
[FunctionAttrs] Make the per-function attribute inference a boring
static function rather than a method. It just needed access to TargetLibraryInfo, and this way it can be easily reused between the current FunctionAttrs implementation and any port for the new pass manager. llvm-svn: 247522
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionAttrs.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index 30c0b3a1763..3ea54687365 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -77,7 +77,6 @@ private:
bool ReturnsNonNull(Function *F, SmallPtrSet<Function *, 8> &,
bool &Speculative) const;
bool AddNonNullAttrs(const CallGraphSCC &SCC);
- bool inferPrototypeAttributes(Function &F);
bool annotateLibraryCalls(const CallGraphSCC &SCC);
};
}
@@ -983,13 +982,13 @@ static void setDoesNotAlias(Function &F, unsigned n) {
/// attributes.
///
/// Returns true if any attributes were set and false otherwise.
-bool FunctionAttrs::inferPrototypeAttributes(Function &F) {
+static bool inferPrototypeAttributes(Function &F, const TargetLibraryInfo &TLI) {
if (F.hasFnAttribute(Attribute::OptimizeNone))
return false;
FunctionType *FTy = F.getFunctionType();
LibFunc::Func TheLibFunc;
- if (!(TLI->getLibFunc(F.getName(), TheLibFunc) && TLI->has(TheLibFunc)))
+ if (!(TLI.getLibFunc(F.getName(), TheLibFunc) && TLI.has(TheLibFunc)))
return false;
switch (TheLibFunc) {
@@ -1792,7 +1791,7 @@ bool FunctionAttrs::annotateLibraryCalls(const CallGraphSCC &SCC) {
Function *F = (*I)->getFunction();
if (F && F->isDeclaration())
- MadeChange |= inferPrototypeAttributes(*F);
+ MadeChange |= inferPrototypeAttributes(*F, *TLI);
}
return MadeChange;
OpenPOWER on IntegriCloud