[llvm] r247522 - [FunctionAttrs] Make the per-function attribute inference a boring
Chandler Carruth via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 13 01:03:23 PDT 2015
Author: chandlerc
Date: Sun Sep 13 03:03:23 2015
New Revision: 247522
URL: http://llvm.org/viewvc/llvm-project?rev=247522&view=rev
Log:
[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.
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=247522&r1=247521&r2=247522&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp Sun Sep 13 03:03:23 2015
@@ -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,
/// 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
Function *F = (*I)->getFunction();
if (F && F->isDeclaration())
- MadeChange |= inferPrototypeAttributes(*F);
+ MadeChange |= inferPrototypeAttributes(*F, *TLI);
}
return MadeChange;
More information about the llvm-commits
mailing list