15ed8b00dSTeresa Johnson; Test handling when two files with the same source file name contain
25ed8b00dSTeresa Johnson; static read only variables with the same name (which will have the same GUID
35ed8b00dSTeresa Johnson; in the combined index).
45ed8b00dSTeresa Johnson
5e849e59cSTeresa Johnson; REQUIRES: x86-registered-target
6e849e59cSTeresa Johnson
75ed8b00dSTeresa Johnson; Do setup work for all below tests: generate bitcode and combined index
85ed8b00dSTeresa Johnson; RUN: opt -module-summary -module-hash %s -o %t.bc
95ed8b00dSTeresa Johnson; RUN: opt -module-summary -module-hash %p/Inputs/thinlto_backend_local_name_conflict1.ll -o %t2.bc
105ed8b00dSTeresa Johnson; RUN: opt -module-summary -module-hash %p/Inputs/thinlto_backend_local_name_conflict2.ll -o %t3.bc
115ed8b00dSTeresa Johnson; RUN: llvm-lto -thinlto-action=thinlink -o %t4.bc %t.bc %t2.bc %t3.bc
125ed8b00dSTeresa Johnson; RUN: llvm-lto -thinlto-action=distributedindexes -exported-symbol=main -thinlto-index=%t4.bc %t.bc
135ed8b00dSTeresa Johnson
145ed8b00dSTeresa Johnson; This module will import a() and b() which should cause the read only copy
155ed8b00dSTeresa Johnson; of baz from each of those modules to be imported. Check that the both are
165ed8b00dSTeresa Johnson; imported as local copies.
175ed8b00dSTeresa Johnson; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t4.o -x ir %t.bc -c -fthinlto-index=%t.bc.thinlto.bc -save-temps=obj
185ed8b00dSTeresa Johnson; RUN: llvm-dis %t.s.3.import.bc -o - | FileCheck --check-prefix=IMPORT %s
195ed8b00dSTeresa Johnson; IMPORT: @baz.llvm.{{.*}} = internal global i32 10
205ed8b00dSTeresa Johnson; IMPORT: @baz.llvm.{{.*}} = internal global i32 10
215ed8b00dSTeresa Johnson
225ed8b00dSTeresa Johnson; ModuleID = 'local_name_conflict_var_main.o'
235ed8b00dSTeresa Johnsonsource_filename = "local_name_conflict_var_main.c"
24*7b1d7937SAmy Huangtarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
255ed8b00dSTeresa Johnsontarget triple = "x86_64-unknown-linux-gnu"
265ed8b00dSTeresa Johnson
275ed8b00dSTeresa Johnson; Function Attrs: noinline nounwind uwtable
285ed8b00dSTeresa Johnsondefine i32 @main() {
295ed8b00dSTeresa Johnsonentry:
305ed8b00dSTeresa Johnson  %call1 = call i32 (...) @a()
315ed8b00dSTeresa Johnson  %call2 = call i32 (...) @b()
325ed8b00dSTeresa Johnson  ret i32 0
335ed8b00dSTeresa Johnson}
345ed8b00dSTeresa Johnson
355ed8b00dSTeresa Johnsondeclare i32 @a(...)
365ed8b00dSTeresa Johnsondeclare i32 @b(...)
37