summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/FunctionImport
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2017-08-16 17:18:01 +0000
committerXinliang David Li <davidxl@google.com>2017-08-16 17:18:01 +0000
commit71ecaa19ff0a6f63b1e0c9fa6d28f5fa84b8072d (patch)
tree4922a616369879bd8ebc947d830a113a6eb59822 /llvm/test/Transforms/FunctionImport
parent999b1d942627537be989a53748b61b49a1d59a24 (diff)
downloadbcm5719-llvm-71ecaa19ff0a6f63b1e0c9fa6d28f5fa84b8072d.tar.gz
bcm5719-llvm-71ecaa19ff0a6f63b1e0c9fa6d28f5fa84b8072d.zip
[PGO] Fix ThinLTO crash
Differential Revsion: http://reviews.llvm.org/D36640 llvm-svn: 311023
Diffstat (limited to 'llvm/test/Transforms/FunctionImport')
-rw-r--r--llvm/test/Transforms/FunctionImport/Inputs/funcimport_var2.ll7
-rw-r--r--llvm/test/Transforms/FunctionImport/funcimport_var.ll13
2 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Transforms/FunctionImport/Inputs/funcimport_var2.ll b/llvm/test/Transforms/FunctionImport/Inputs/funcimport_var2.ll
new file mode 100644
index 00000000000..88aa79855b9
--- /dev/null
+++ b/llvm/test/Transforms/FunctionImport/Inputs/funcimport_var2.ll
@@ -0,0 +1,7 @@
+@link = internal global i32 0, align 4
+
+; Function Attrs: norecurse nounwind readnone uwtable
+define nonnull i32* @get_link() local_unnamed_addr {
+ ret i32* @link
+}
+
diff --git a/llvm/test/Transforms/FunctionImport/funcimport_var.ll b/llvm/test/Transforms/FunctionImport/funcimport_var.ll
new file mode 100644
index 00000000000..b749ec4a9ae
--- /dev/null
+++ b/llvm/test/Transforms/FunctionImport/funcimport_var.ll
@@ -0,0 +1,13 @@
+; This test makes sure a static var is not selected as a callee target
+; (which will crash compilation).
+; RUN: opt -module-summary %s -o %t.bc
+; RUN: opt -module-summary %p/Inputs/funcimport_var2.ll -o %t2.bc
+; RUN: llvm-lto -thinlto -thinlto-action=thinlink -o %t3 %t.bc %t2.bc
+; RUN: llvm-lto -thinlto -thinlto-action=import -thinlto-index=%t3 %t.bc %t2.bc
+define i32 @_Z4LinkPKcS0_(i8*, i8*) local_unnamed_addr {
+ %3 = tail call i32 @link(i8* %0, i8* %1) #2
+ ret i32 %3
+}
+
+; Function Attrs: nounwind
+declare i32 @link(i8*, i8*) local_unnamed_addr
OpenPOWER on IntegriCloud