• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test handling when two files with the same source file name contain
2; static functions/variables with the same name (which will have the same GUID
3; in the combined index.
4
5; Do setup work for all below tests: generate bitcode and combined index
6; RUN: opt -module-summary -module-hash %s -o %t.bc
7; RUN: opt -module-summary -module-hash %p/Inputs/local_name_conflict1.ll -o %t2.bc
8; RUN: opt -module-summary -module-hash %p/Inputs/local_name_conflict2.ll -o %t3.bc
9; RUN: llvm-lto -thinlto-action=thinlink -o %t4.bc %t.bc %t2.bc %t3.bc
10
11; This module will import b() which should cause the copy of foo and baz from
12; that module (%t3.bc) to be imported. Check that the imported reference's
13; promoted name matches the imported copy.
14; RUN: llvm-lto -thinlto-action=import %t.bc -thinlto-index=%t4.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=IMPORT
15; IMPORT: @baz.llvm.[[HASH:[0-9]+]] = internal constant i32 10, align 4
16; IMPORT: call i32 @foo.llvm.[[HASH]]
17; IMPORT: define available_externally hidden i32 @foo.llvm.[[HASH]]()
18
19; The copy in %t2.bc should not be exported/promoted/renamed
20; RUN: llvm-lto -thinlto-action=promote %t2.bc -thinlto-index=%t4.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=NOEXPORTSTATIC
21; NOEXPORTSTATIC: @baz = internal constant i32 10, align 4
22; NOEXPORTSTATIC: define internal i32 @foo()
23
24; Make sure foo is promoted and renamed without complaint in %t3.bc.
25; RUN: llvm-lto -thinlto-action=promote %t3.bc -thinlto-index=%t4.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=EXPORTSTATIC
26; EXPORTSTATIC: @baz.llvm.{{.*}} = hidden constant i32 10, align 4
27; EXPORTSTATIC: define hidden i32 @foo.llvm.
28
29; ModuleID = 'local_name_conflict_main.o'
30source_filename = "local_name_conflict_main.c"
31target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
32target triple = "x86_64-unknown-linux-gnu"
33
34; Function Attrs: noinline nounwind uwtable
35define i32 @main() {
36entry:
37  %retval = alloca i32, align 4
38  store i32 0, i32* %retval, align 4
39  %call = call i32 (...) @b()
40  ret i32 %call
41}
42
43declare i32 @b(...)
44