44 lines · plain
1; Test handling when two files with the same source file name contain2; static functions/variables with the same name (which will have the same GUID3; in the combined index.4 5; Do setup work for all below tests: generate bitcode and combined index6; RUN: opt -module-summary -module-hash %s -o %t.bc7; RUN: opt -module-summary -module-hash %p/Inputs/local_name_conflict1.ll -o %t2.bc8; RUN: opt -module-summary -module-hash %p/Inputs/local_name_conflict2.ll -o %t3.bc9; RUN: llvm-lto -thinlto-action=thinlink -o %t4.bc %t.bc %t2.bc %t3.bc10 11; This module will import b() which should cause the copy of foo and baz from12; that module (%t3.bc) to be imported. Check that the imported reference's13; 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=IMPORT15; IMPORT: @baz.llvm.[[HASH:[0-9]+]] = internal constant i32 10, align 416; 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/renamed20; RUN: llvm-lto -thinlto-action=promote %t2.bc -thinlto-index=%t4.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=NOEXPORTSTATIC21; NOEXPORTSTATIC: @baz = internal constant i32 10, align 422; 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=EXPORTSTATIC26; EXPORTSTATIC: @baz.llvm.{{.*}} = hidden constant i32 10, align 427; 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 uwtable35define i32 @main() {36entry:37 %retval = alloca i32, align 438 store i32 0, ptr %retval, align 439 %call = call i32 (...) @b()40 ret i32 %call41}42 43declare i32 @b(...)44