summaryrefslogtreecommitdiff
path: root/test/ThinLTO
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-11-03 01:07:16 +0000
committerTeresa Johnson <tejohnson@google.com>2016-11-03 01:07:16 +0000
commit6e15e36dae54361e9f21b7711ad9bca48923f64a (patch)
tree07c8ced8e4599a3dada9aac7ae7011a16fa80e9c /test/ThinLTO
parent2ad749ea5e2d257988092bb6b6a5698e32636a41 (diff)
downloadllvm-6e15e36dae54361e9f21b7711ad9bca48923f64a.tar.gz
[ThinLTO] Handle distributed backend case when doing renaming
Summary: The recent change I made to consult the summary when deciding whether to rename (to handle inline asm) in r285513 broke the distributed build case. In a distributed backend we will only have a portion of the combined index, specifically for imported modules we only have the summaries for any imported definitions. When renaming on import we were asserting because no summary entry was found for a local reference being linked in (def wasn't imported). We only need to consult the summary for a renaming decision for the exporting module. For imports, we would have prevented importing any references to NoRename values already. Reviewers: mehdi_amini Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D26250 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285871 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ThinLTO')
-rw-r--r--test/ThinLTO/X86/Inputs/distributed_import.ll6
-rw-r--r--test/ThinLTO/X86/distributed_import.ll20
2 files changed, 26 insertions, 0 deletions
diff --git a/test/ThinLTO/X86/Inputs/distributed_import.ll b/test/ThinLTO/X86/Inputs/distributed_import.ll
new file mode 100644
index 000000000000..759c33714344
--- /dev/null
+++ b/test/ThinLTO/X86/Inputs/distributed_import.ll
@@ -0,0 +1,6 @@
+@G = internal global i32 7
+define i32 @g() {
+entry:
+ %0 = load i32, i32* @G
+ ret i32 %0
+}
diff --git a/test/ThinLTO/X86/distributed_import.ll b/test/ThinLTO/X86/distributed_import.ll
new file mode 100644
index 000000000000..b1ffd51359da
--- /dev/null
+++ b/test/ThinLTO/X86/distributed_import.ll
@@ -0,0 +1,20 @@
+; RUN: opt -module-summary %s -o %t1.bc
+; RUN: opt -module-summary %p/Inputs/distributed_import.ll -o %t2.bc
+
+; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
+; RUN: -thinlto-distributed-indexes \
+; RUN: -r=%t1.bc,g, \
+; RUN: -r=%t1.bc,f,px \
+; RUN: -r=%t2.bc,g,px
+; RUN: opt -function-import -summary-file %t1.bc.thinlto.bc %t1.bc -o %t1.out
+; RUN: opt -function-import -summary-file %t2.bc.thinlto.bc %t2.bc -o %t2.out
+; RUN: llvm-dis -o - %t2.out | FileCheck %s
+; CHECK: @G.llvm.0
+
+declare i32 @g(...)
+
+define void @f() {
+entry:
+ call i32 (...) @g()
+ ret void
+}