mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 15:13:49 -04:00
[ThinLTO] Update handling of vararg functions to match inliner
Summary: Previously we marked all vararg functions as non-inlinable in the function summary, which prevented their importing. However, the corresponding inliner restriction was loosened in r321940/r342675 to only apply to functions calling va_start. Adjust the summary flag computation to match. Reviewers: davidxl Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D54270 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346883 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -246,10 +246,15 @@ static void computeFunctionSummary(
|
||||
findRefEdges(Index, &F, RefEdges, Visited);
|
||||
|
||||
bool HasInlineAsmMaybeReferencingInternal = false;
|
||||
bool InitsVarArgs = false;
|
||||
for (const BasicBlock &BB : F)
|
||||
for (const Instruction &I : BB) {
|
||||
if (isa<DbgInfoIntrinsic>(I))
|
||||
continue;
|
||||
if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(&I)) {
|
||||
if (II->getIntrinsicID() == Intrinsic::vastart)
|
||||
InitsVarArgs = true;
|
||||
}
|
||||
++NumInsts;
|
||||
findRefEdges(Index, &I, RefEdges, Visited);
|
||||
auto CS = ImmutableCallSite(&I);
|
||||
@@ -357,9 +362,9 @@ static void computeFunctionSummary(
|
||||
F.hasFnAttribute(Attribute::ReadNone),
|
||||
F.hasFnAttribute(Attribute::ReadOnly),
|
||||
F.hasFnAttribute(Attribute::NoRecurse), F.returnDoesNotAlias(),
|
||||
// Inliner doesn't handle variadic functions.
|
||||
// Inliner doesn't handle variadic functions with va_start calls.
|
||||
// FIXME: refactor this to use the same code that inliner is using.
|
||||
F.isVarArg() ||
|
||||
InitsVarArgs ||
|
||||
// Don't try to import functions with noinline attribute.
|
||||
F.getAttributes().hasFnAttribute(Attribute::NoInline)};
|
||||
auto FuncSummary = llvm::make_unique<FunctionSummary>(
|
||||
|
||||
Reference in New Issue
Block a user