From 5b8ff375c84a57e63a50ed223b1f8896da149a65 Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Sat, 1 Dec 2018 05:11:46 +0000 Subject: [ThinLTO] Allow importing of functions with var args Summary: Follow up to D54270, which allowed importing of var args functions unless they called va_start. As pointed out in the post-commit comments on that patch, the inliner can handle functions that call va_start in certain situations as well. Go ahead and enable importing of all var args functions. Measurements on a large binary show that this increases imports and binary size by an insignificant amount. Reviewers: davidxl Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D54607 llvm-svn: 348068 --- llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'llvm/lib/Analysis/ModuleSummaryAnalysis.cpp') diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp index 5a13149c022..fe318548b64 100644 --- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -256,15 +256,10 @@ static void computeFunctionSummary(ModuleSummaryIndex &Index, const Module &M, std::vector NonVolatileLoads; bool HasInlineAsmMaybeReferencingInternal = false; - bool InitsVarArgs = false; for (const BasicBlock &BB : F) for (const Instruction &I : BB) { if (isa(I)) continue; - if (const IntrinsicInst *II = dyn_cast(&I)) { - if (II->getIntrinsicID() == Intrinsic::vastart) - InitsVarArgs = true; - } ++NumInsts; if (isNonVolatileLoad(&I)) { // Postpone processing of non-volatile load instructions @@ -397,11 +392,9 @@ static void computeFunctionSummary(ModuleSummaryIndex &Index, const Module &M, F.hasFnAttribute(Attribute::ReadNone), F.hasFnAttribute(Attribute::ReadOnly), F.hasFnAttribute(Attribute::NoRecurse), F.returnDoesNotAlias(), - // Inliner doesn't handle variadic functions with va_start calls. // FIXME: refactor this to use the same code that inliner is using. - InitsVarArgs || - // Don't try to import functions with noinline attribute. - F.getAttributes().hasFnAttribute(Attribute::NoInline)}; + // Don't try to import functions with noinline attribute. + F.getAttributes().hasFnAttribute(Attribute::NoInline)}; auto FuncSummary = llvm::make_unique( Flags, NumInsts, FunFlags, std::move(Refs), CallGraphEdges.takeVector(), TypeTests.takeVector(), TypeTestAssumeVCalls.takeVector(), -- cgit v1.2.3