mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-20 11:08:27 +00:00
[FunctionAttrs] Inline the prototype attribute inference to an existing
loop over the SCC. The separate function wasn't really adding much, NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251728 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e39e3a473d
commit
f73144bb03
@ -73,8 +73,6 @@ struct FunctionAttrs : public CallGraphSCCPass {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
TargetLibraryInfo *TLI;
|
TargetLibraryInfo *TLI;
|
||||||
|
|
||||||
bool annotateLibraryCalls(const CallGraphSCC &SCC);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1750,27 +1748,9 @@ static bool inferPrototypeAttributes(Function &F, const TargetLibraryInfo &TLI)
|
|||||||
return true;
|
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) {
|
bool FunctionAttrs::runOnSCC(CallGraphSCC &SCC) {
|
||||||
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
|
||||||
|
bool Changed = false;
|
||||||
// Annotate declarations for which we have special knowledge.
|
|
||||||
bool Changed = annotateLibraryCalls(SCC);
|
|
||||||
|
|
||||||
// We compute dedicated AA results for each function in the SCC as needed. We
|
// 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
|
// use a lambda referencing external objects so that they live long enough to
|
||||||
@ -1798,6 +1778,11 @@ bool FunctionAttrs::runOnSCC(CallGraphSCC &SCC) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When initially processing functions, also infer their prototype
|
||||||
|
// attributes if they are declarations.
|
||||||
|
if (F->isDeclaration())
|
||||||
|
Changed |= inferPrototypeAttributes(*F, *TLI);
|
||||||
|
|
||||||
SCCNodes.insert(F);
|
SCCNodes.insert(F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user