[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:
Teresa Johnson
2018-11-14 19:30:13 +00:00
parent c79bd8af97
commit ada45e1a6f
4 changed files with 50 additions and 15 deletions

View File

@@ -13,18 +13,23 @@
; BC-NEXT: <FUNCTION op0=7 op1=39
; "variadic"
; BC-NEXT: <FUNCTION op0=46 op1=8
; "llvm.va_start"
; BC-NEXT: <FUNCTION op0=54 op1=13
; "f"
; BC-NEXT: <ALIAS op0=54 op1=1
; BC-NEXT: <ALIAS op0=67 op1=1
; BC: <GLOBALVAL_SUMMARY_BLOCK
; BC-NEXT: <VERSION
; BC-NEXT: <PERMODULE {{.*}} op0=1 op1=0
; BC-NEXT: <PERMODULE {{.*}} op0=2 op1=0
; BC-NEXT: <PERMODULE {{.*}} op0=3 op1=7
; BC-NEXT: <PERMODULE {{.*}} op0=4 op1=0 op2=1 op3=16
; BC-NEXT: <ALIAS {{.*}} op0=5 op1=0 op2=3
; 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: <ALIAS {{.*}} op0=6 op1=0 op2=3
; BC-NEXT: </GLOBALVAL_SUMMARY_BLOCK
; BC: <STRTAB_BLOCK
; BC-NEXT: blob data = 'hfoobaranon.{{................................}}.0variadicf{{.*}}'
; BC-NEXT: blob data = 'hfoobaranon.{{................................}}.0variadicllvm.va_startf{{.*}}'
; RUN: opt -name-anon-globals -module-summary < %s | llvm-dis | FileCheck %s
@@ -68,5 +73,10 @@ return: ; preds = %entry
}
define i32 @variadic(...) {
%ap = alloca i8*, align 8
%ap.0 = bitcast i8** %ap to i8*
call void @llvm.va_start(i8* %ap.0)
ret i32 42
}
declare void @llvm.va_start(i8*) nounwind