summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-01-12 17:48:44 +0000
committerTeresa Johnson <tejohnson@google.com>2016-01-12 17:48:44 +0000
commit388497e8be631e61081ddf7ff5204cf79493d2f1 (patch)
treef2768fab689e45bf5c288f0a244fee609b7b7575 /llvm/test
parent3a5b6e275013276b253246f2b4de4146fcafd881 (diff)
downloadbcm5719-llvm-388497e8be631e61081ddf7ff5204cf79493d2f1.tar.gz
bcm5719-llvm-388497e8be631e61081ddf7ff5204cf79493d2f1.zip
[ThinLTO] Handle an external call from an import to an alias in dest
The findExternalCalls routine ignores calls to functions already defined in the dest module. This was not handling the case where the definition in the current module is actually an alias to a function call. llvm-svn: 257493
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/FunctionImport/Inputs/funcimport_alias.ll7
-rw-r--r--llvm/test/Transforms/FunctionImport/funcimport_alias.ll25
2 files changed, 32 insertions, 0 deletions
diff --git a/llvm/test/Transforms/FunctionImport/Inputs/funcimport_alias.ll b/llvm/test/Transforms/FunctionImport/Inputs/funcimport_alias.ll
new file mode 100644
index 00000000000..f897aeda6ce
--- /dev/null
+++ b/llvm/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/llvm/test/Transforms/FunctionImport/funcimport_alias.ll b/llvm/test/Transforms/FunctionImport/funcimport_alias.ll
new file mode 100644
index 00000000000..0a6c4372557
--- /dev/null
+++ b/llvm/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 %t3.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()
OpenPOWER on IntegriCloud