[PATCH] D54607: [ThinLTO] Allow importing of functions with var args
Teresa Johnson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 30 21:14:45 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL348068: [ThinLTO] Allow importing of functions with var args (authored by tejohnson, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D54607?vs=174299&id=176241#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54607/new/
https://reviews.llvm.org/D54607
Files:
llvm/trunk/lib/Analysis/ModuleSummaryAnalysis.cpp
llvm/trunk/test/Bitcode/thinlto-function-summary.ll
llvm/trunk/test/Transforms/FunctionImport/funcimport.ll
Index: llvm/trunk/test/Bitcode/thinlto-function-summary.ll
===================================================================
--- llvm/trunk/test/Bitcode/thinlto-function-summary.ll
+++ llvm/trunk/test/Bitcode/thinlto-function-summary.ll
@@ -22,10 +22,7 @@
; BC-NEXT: <PERMODULE {{.*}} op0=1 op1=0
; BC-NEXT: <PERMODULE {{.*}} op0=2 op1=0
; BC-NEXT: <PERMODULE {{.*}} op0=3 op1=7
-; Summary for @variadic has flags (op3) = 16 since non-inlinable owing to
-; va_start call.
-; flag is set due to va_start call.
-; BC-NEXT: <PERMODULE {{.*}} op0=4 op1=0 op2=4 op3=16
+; BC-NEXT: <PERMODULE {{.*}} op0=4 op1=0 op2=4 op3=0
; BC-NEXT: <ALIAS {{.*}} op0=6 op1=0 op2=3
; BC-NEXT: </GLOBALVAL_SUMMARY_BLOCK
; BC: <STRTAB_BLOCK
Index: llvm/trunk/test/Transforms/FunctionImport/funcimport.ll
===================================================================
--- llvm/trunk/test/Transforms/FunctionImport/funcimport.ll
+++ llvm/trunk/test/Transforms/FunctionImport/funcimport.ll
@@ -110,13 +110,13 @@
; CHECK-DAG: define available_externally void @variadic_no_va_start(...) !thinlto_src_module !0 {
declare void @variadic_no_va_start(...)
-; We shouldn't import variadic functions without a va_start, since the inliner
-; cannot handle them.
-; CHECK-DAG: declare void @variadic_va_start(...)
+; We can import variadic functions with a va_start, since the inliner
+; can sometimes handle them.
+; CHECK-DAG: define available_externally void @variadic_va_start(...)
declare void @variadic_va_start(...)
; INSTLIMDEF-DAG: Import globalfunc2
-; INSTLIMDEF-DAG: 14 function-import - Number of functions imported
+; INSTLIMDEF-DAG: 15 function-import - Number of functions imported
; INSTLIMDEF-DAG: 4 function-import - Number of global variables imported
; CHECK-DAG: !0 = !{!"{{.*}}/Inputs/funcimport.ll"}
@@ -156,7 +156,7 @@
; GUID-DAG: GUID {{.*}} is linkoncefunc
; DUMP: Module [[M1:.*]] imports from 1 module
-; DUMP-NEXT: 14 functions imported from [[M2:.*]]
+; DUMP-NEXT: 15 functions imported from [[M2:.*]]
; DUMP-NEXT: 4 vars imported from [[M2]]
-; DUMP: Imported 14 functions for Module [[M1]]
+; DUMP: Imported 15 functions for Module [[M1]]
; DUMP-NEXT: Imported 4 global variables for Module [[M1]]
Index: llvm/trunk/lib/Analysis/ModuleSummaryAnalysis.cpp
===================================================================
--- llvm/trunk/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ llvm/trunk/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -256,15 +256,10 @@
std::vector<const Instruction *> NonVolatileLoads;
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;
if (isNonVolatileLoad(&I)) {
// Postpone processing of non-volatile load instructions
@@ -397,11 +392,9 @@
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<FunctionSummary>(
Flags, NumInsts, FunFlags, std::move(Refs), CallGraphEdges.takeVector(),
TypeTests.takeVector(), TypeTestAssumeVCalls.takeVector(),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54607.176241.patch
Type: text/x-patch
Size: 3882 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181201/64a9bd41/attachment-0001.bin>
More information about the llvm-commits
mailing list