summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorSameer AbuAsal <sabuasal@codeaurora.org>2018-09-20 18:39:34 +0000
committerSameer AbuAsal <sabuasal@codeaurora.org>2018-09-20 18:39:34 +0000
commit77beee413648b117491eb9bd184ba99daee95667 (patch)
treea5ddb7d47618d2fbef51981c07ab066a059c0fa4 /llvm/lib/Analysis
parent392bf6af0fb951ee79d5af96f18aa47ba0bc4169 (diff)
downloadbcm5719-llvm-77beee413648b117491eb9bd184ba99daee95667.tar.gz
bcm5719-llvm-77beee413648b117491eb9bd184ba99daee95667.zip
[inline Cost] Don't mark functions accessing varargs as non-inlinable
Summary: rL323619 marks functions that are calling va_end as not viable for inlining. This patch reverses that since this va_end doesn't need access to the vriadic arguments list that are saved on the stack, only va_start does. Reviewers: efriedma, fhahn Reviewed By: fhahn Subscribers: eraman, haicheng, llvm-commits Differential Revision: https://reviews.llvm.org/D52067 llvm-svn: 342675
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 1d879f8aee9..fb032e0404c 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -137,7 +137,7 @@ class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> {
bool HasReturn;
bool HasIndirectBr;
bool HasUninlineableIntrinsic;
- bool UsesVarArgs;
+ bool InitsVargArgs;
/// Number of bytes allocated statically by the callee.
uint64_t AllocatedSize;
@@ -283,7 +283,7 @@ public:
IsCallerRecursive(false), IsRecursiveCall(false),
ExposesReturnsTwice(false), HasDynamicAlloca(false),
ContainsNoDuplicateCall(false), HasReturn(false), HasIndirectBr(false),
- HasUninlineableIntrinsic(false), UsesVarArgs(false), AllocatedSize(0),
+ HasUninlineableIntrinsic(false), InitsVargArgs(false), AllocatedSize(0),
NumInstructions(0), NumVectorInstructions(0), VectorBonus(0),
SingleBBBonus(0), EnableLoadElimination(true), LoadEliminationCost(0),
NumConstantArgs(0), NumConstantOffsetPtrArgs(0), NumAllocaArgs(0),
@@ -1239,8 +1239,7 @@ bool CallAnalyzer::visitCallSite(CallSite CS) {
HasUninlineableIntrinsic = true;
return false;
case Intrinsic::vastart:
- case Intrinsic::vaend:
- UsesVarArgs = true;
+ InitsVargArgs = true;
return false;
}
}
@@ -1587,7 +1586,7 @@ CallAnalyzer::analyzeBlock(BasicBlock *BB,
IR = "indirect branch";
else if (HasUninlineableIntrinsic)
IR = "uninlinable intrinsic";
- else if (UsesVarArgs)
+ else if (InitsVargArgs)
IR = "varargs";
if (!IR) {
if (ORE)
@@ -2079,9 +2078,8 @@ bool llvm::isInlineViable(Function &F) {
// Disallow inlining functions that call @llvm.localescape. Doing this
// correctly would require major changes to the inliner.
case llvm::Intrinsic::localescape:
- // Disallow inlining of functions that access VarArgs.
+ // Disallow inlining of functions that initialize VarArgs with va_start.
case llvm::Intrinsic::vastart:
- case llvm::Intrinsic::vaend:
return false;
}
}
OpenPOWER on IntegriCloud