diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-01-13 19:58:01 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-01-13 19:58:01 +0000 |
| commit | 050e163ae8b4bb6eb252b59e2f8f36e68ae9239d (patch) | |
| tree | 7376a0c71aad05d327e5b1dcbceb3311a10f9f29 /test/Transforms/FunctionImport | |
| parent | 8a6c1c25bce0267ee4072bd7b786b921e8a66a35 (diff) | |
Notes
Diffstat (limited to 'test/Transforms/FunctionImport')
5 files changed, 61 insertions, 2 deletions
diff --git a/test/Transforms/FunctionImport/Inputs/funcimport.ll b/test/Transforms/FunctionImport/Inputs/funcimport.ll index 96555892fe3c..79b766b386df 100644 --- a/test/Transforms/FunctionImport/Inputs/funcimport.ll +++ b/test/Transforms/FunctionImport/Inputs/funcimport.ll @@ -10,6 +10,7 @@ define void @globalfunc1() #0 { entry: + call void @funcwithpersonality() ret void } @@ -79,6 +80,20 @@ entry: ret i32 1 } +declare i32 @__gxx_personality_v0(...) + +; Add enough instructions to prevent import with inst limit of 5 +define internal void @funcwithpersonality() #2 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { +entry: + call void @globalfunc2() + call void @globalfunc2() + call void @globalfunc2() + call void @globalfunc2() + call void @globalfunc2() + call void @globalfunc2() + ret void +} + define internal void @staticfunc2() #0 { entry: ret void diff --git a/test/Transforms/FunctionImport/Inputs/funcimport_alias.ll b/test/Transforms/FunctionImport/Inputs/funcimport_alias.ll new file mode 100644 index 000000000000..f897aeda6ce1 --- /dev/null +++ b/test/Transforms/FunctionImport/Inputs/funcimport_alias.ll @@ -0,0 +1,7 @@ +declare void @analias() + +define void @callanalias() #0 { +entry: + call void @analias() + ret void +} diff --git a/test/Transforms/FunctionImport/funcimport.ll b/test/Transforms/FunctionImport/funcimport.ll index c099b9766477..52fd53d3f31f 100644 --- a/test/Transforms/FunctionImport/funcimport.ll +++ b/test/Transforms/FunctionImport/funcimport.ll @@ -73,3 +73,5 @@ declare void @callfuncptr(...) #1 ; CHECK-DAG: declare void @weakfunc(...) declare void @weakfunc(...) #1 +; INSTLIMDEF-DAG: define available_externally hidden void @funcwithpersonality.llvm.2() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { +; INSTLIM5-DAG: declare hidden void @funcwithpersonality.llvm.2() diff --git a/test/Transforms/FunctionImport/funcimport_alias.ll b/test/Transforms/FunctionImport/funcimport_alias.ll new file mode 100644 index 000000000000..8c7f00fe37b3 --- /dev/null +++ b/test/Transforms/FunctionImport/funcimport_alias.ll @@ -0,0 +1,25 @@ +; Do setup work for all below tests: generate bitcode and combined index +; RUN: llvm-as -function-summary %s -o %t.bc +; RUN: llvm-as -function-summary %p/Inputs/funcimport_alias.ll -o %t2.bc +; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc + +; Do the import now. Ensures that the importer handles an external call +; from imported callanalias() to a function that is defined already in +; the dest module, but as an alias. +; RUN: opt -function-import -summary-file %t3.thinlto.bc %s -S | FileCheck %s + +define i32 @main() #0 { +entry: + call void @callanalias() + ret i32 0 +} + +@analias = alias void (), void ()* @globalfunc + +define void @globalfunc() #0 { +entry: + ret void +} + +declare void @callanalias() #1 +; CHECK-DAG: define available_externally void @callanalias() diff --git a/test/Transforms/FunctionImport/funcimport_debug.ll b/test/Transforms/FunctionImport/funcimport_debug.ll index c57b5e14af1b..96b73a3f6bc7 100644 --- a/test/Transforms/FunctionImport/funcimport_debug.ll +++ b/test/Transforms/FunctionImport/funcimport_debug.ll @@ -7,8 +7,18 @@ ; RUN: opt -function-import -summary-file %t3.thinlto.bc %s -S | FileCheck %s ; CHECK: define available_externally void @func() -; CHECK: distinct !DISubprogram(name: "main" -; CHECK: distinct !DISubprogram(name: "func" + +; Check that we have exactly two subprograms (that func's subprogram wasn't +; linked more than once for example), and that they are connected to +; the subprogram list on a compute unit. +; CHECK: !{{[0-9]+}} = distinct !DICompileUnit({{.*}} subprograms: ![[SPs1:[0-9]+]] +; CHECK: ![[SPs1]] = !{![[MAINSP:[0-9]+]]} +; CHECK: ![[MAINSP]] = distinct !DISubprogram(name: "main" +; CHECK: !{{[0-9]+}} = distinct !DICompileUnit({{.*}} subprograms: ![[SPs2:[0-9]+]] +; CHECK-NOT: ![[SPs2]] = !{{{.*}}null{{.*}}} +; CHECK: ![[SPs2]] = !{![[FUNCSP:[0-9]+]]} +; CHECK: ![[FUNCSP]] = distinct !DISubprogram(name: "func" +; CHECK-NOT: distinct !DISubprogram ; ModuleID = 'funcimport_debug.o' target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
