summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2015-09-13 08:23:27 +0000
committerChandler Carruth <chandlerc@gmail.com>2015-09-13 08:23:27 +0000
commit3824f859f5805590201450bd4a26294d61e382e9 (patch)
treefc2b8cfa1053cc30c0619b41fe5c4b998c760e79 /llvm/lib/Transforms
parent8874b78697cf09fde54c95df6de43c1acd7e9b75 (diff)
downloadbcm5719-llvm-3824f859f5805590201450bd4a26294d61e382e9.tar.gz
bcm5719-llvm-3824f859f5805590201450bd4a26294d61e382e9.zip
[FunctionAttrs] Move the malloc-like test to a static helper function
that could be used from a new pass manager. This one makes particular sense as a static helper as it doesn't even need TLI. llvm-svn: 247525
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 cfeedf6d1db..109ef16872a 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -72,7 +72,6 @@ private:
bool AddReadAttrs(const CallGraphSCC &SCC);
bool AddArgumentAttrs(const CallGraphSCC &SCC);
- bool IsFunctionMallocLike(Function *F, SmallPtrSet<Function *, 8> &) const;
bool AddNoAliasAttrs(const CallGraphSCC &SCC);
bool AddNonNullAttrs(const CallGraphSCC &SCC);
bool annotateLibraryCalls(const CallGraphSCC &SCC);
@@ -682,8 +681,8 @@ bool FunctionAttrs::AddArgumentAttrs(const CallGraphSCC &SCC) {
///
/// A function is "malloc-like" if it returns either null or a pointer that
/// doesn't alias any other pointer visible to the caller.
-bool FunctionAttrs::IsFunctionMallocLike(
- Function *F, SmallPtrSet<Function *, 8> &SCCNodes) const {
+static bool isFunctionMallocLike(Function *F,
+ SmallPtrSet<Function *, 8> &SCCNodes) {
SmallSetVector<Value *, 8> FlowsToReturn;
for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I)
if (ReturnInst *Ret = dyn_cast<ReturnInst>(I->getTerminator()))
@@ -777,7 +776,7 @@ bool FunctionAttrs::AddNoAliasAttrs(const CallGraphSCC &SCC) {
if (!F->getReturnType()->isPointerTy())
continue;
- if (!IsFunctionMallocLike(F, SCCNodes))
+ if (!isFunctionMallocLike(F, SCCNodes))
return false;
}
OpenPOWER on IntegriCloud