diff options
| author | Steven Wu <stevenwu@apple.com> | 2018-11-13 17:35:04 +0000 |
|---|---|---|
| committer | Steven Wu <stevenwu@apple.com> | 2018-11-13 17:35:04 +0000 |
| commit | fa43892d6fdf77e373dcf54f1c934380b8731df2 (patch) | |
| tree | 4908fa417e03b50a4713544230c993893fd38afb /llvm/test/ThinLTO/X86 | |
| parent | 77c17e26eaca06626a4ad1d9b2ccaba28d15b62f (diff) | |
| download | bcm5719-llvm-fa43892d6fdf77e373dcf54f1c934380b8731df2.tar.gz bcm5719-llvm-fa43892d6fdf77e373dcf54f1c934380b8731df2.zip | |
Revert "[ThinLTO] Internalize readonly globals"
This reverts commit 10c84a8f35cae4a9fc421648d9608fccda3925f2.
llvm-svn: 346768
Diffstat (limited to 'llvm/test/ThinLTO/X86')
19 files changed, 7 insertions, 418 deletions
diff --git a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-alias.ll b/llvm/test/ThinLTO/X86/Inputs/index-const-prop-alias.ll deleted file mode 100644 index d5aa6ee0b61..00000000000 --- a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-alias.ll +++ /dev/null @@ -1,5 +0,0 @@ -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@g = global i32 42, align 4 -@g.alias = weak alias i32, i32* @g diff --git a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-comdat.ll b/llvm/test/ThinLTO/X86/Inputs/index-const-prop-comdat.ll deleted file mode 100644 index 819ba8caa32..00000000000 --- a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-comdat.ll +++ /dev/null @@ -1,5 +0,0 @@ -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -$comdat.any = comdat any -@g = global i32 42, comdat($comdat.any) diff --git a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-define-g.ll b/llvm/test/ThinLTO/X86/Inputs/index-const-prop-define-g.ll deleted file mode 100644 index 555f76f5930..00000000000 --- a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-define-g.ll +++ /dev/null @@ -1,4 +0,0 @@ -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@g = global i32 42, align 4 diff --git a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-full-lto.ll b/llvm/test/ThinLTO/X86/Inputs/index-const-prop-full-lto.ll deleted file mode 100644 index e22f9198951..00000000000 --- a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-full-lto.ll +++ /dev/null @@ -1,12 +0,0 @@ -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@g = external global i32 - -define i32 @foo() { - %v = load i32, i32* @g - ret i32 %v -} - -!0 = !{i32 1, !"ThinLTO", i32 0} -!llvm.module.flags = !{ !0 } diff --git a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-gvref.ll b/llvm/test/ThinLTO/X86/Inputs/index-const-prop-gvref.ll deleted file mode 100644 index ec0de9c9141..00000000000 --- a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-gvref.ll +++ /dev/null @@ -1,5 +0,0 @@ -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@b = global i32* @a, align 8 -@a = global i32 42, align 4 diff --git a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-linkage.ll b/llvm/test/ThinLTO/X86/Inputs/index-const-prop-linkage.ll deleted file mode 100644 index 24c724743e0..00000000000 --- a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-linkage.ll +++ /dev/null @@ -1,15 +0,0 @@ -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@g1 = common global i32 0, align 4 -@g2 = global i32 42, align 4 -@g3 = available_externally global i32 42, align 4 - -define i32 @foo() { - %v1 = load i32, i32* @g1 - %v2 = load i32, i32* @g2 - %v3 = load i32, i32* @g3 - %s1 = add i32 %v1, %v2 - %s2 = add i32 %s1, %v3 - ret i32 %s2 -} diff --git a/llvm/test/ThinLTO/X86/Inputs/index-const-prop.ll b/llvm/test/ThinLTO/X86/Inputs/index-const-prop.ll deleted file mode 100644 index eda62fb4e5b..00000000000 --- a/llvm/test/ThinLTO/X86/Inputs/index-const-prop.ll +++ /dev/null @@ -1,64 +0,0 @@ -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-pc-linux-gnu" - -@gBar = local_unnamed_addr global i32 2, align 4, !dbg !0 -@gFoo = internal unnamed_addr global i32 1, align 4, !dbg !6 - -; Function Attrs: norecurse nounwind readonly -define i32 @foo() local_unnamed_addr #0 !dbg !14 { - %1 = load i32, i32* @gFoo, align 4, !dbg !17 - ret i32 %1, !dbg !18 -} - -; Function Attrs: norecurse nounwind readonly -define i32 @bar() local_unnamed_addr #0 !dbg !19 { - %1 = load i32, i32* @gBar, align 4, !dbg !20 - ret i32 %1, !dbg !21 -} - -define void @baz() local_unnamed_addr !dbg !22 { - %1 = tail call i32 @rand(), !dbg !25 - store i32 %1, i32* @gFoo, align 4, !dbg !26 - %2 = tail call i32 @rand(), !dbg !27 - store i32 %2, i32* @gBar, align 4, !dbg !28 - ret void, !dbg !29 -} - -declare i32 @rand() local_unnamed_addr - -attributes #0 = { norecurse nounwind readonly } - -!llvm.dbg.cu = !{!2} -!llvm.module.flags = !{!9, !10, !11, !12} -!llvm.ident = !{!13} - -!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) -!1 = distinct !DIGlobalVariable(name: "gBar", scope: !2, file: !3, line: 4, type: !8, isLocal: false, isDefinition: true) -!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 7.0.0 (trunk 332246)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) -!3 = !DIFile(filename: "foo.c", directory: "/data/work/lto/roref/test") -!4 = !{} -!5 = !{!0, !6} -!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression()) -!7 = distinct !DIGlobalVariable(name: "gFoo", scope: !2, file: !3, line: 3, type: !8, isLocal: true, isDefinition: true) -!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -!9 = !{i32 2, !"Dwarf Version", i32 4} -!10 = !{i32 2, !"Debug Info Version", i32 3} -!11 = !{i32 1, !"wchar_size", i32 4} -!12 = !{i32 7, !"PIC Level", i32 2} -!13 = !{!"clang version 7.0.0 (trunk 332246)"} -!14 = distinct !DISubprogram(name: "foo", scope: !3, file: !3, line: 6, type: !15, isLocal: false, isDefinition: true, scopeLine: 6, isOptimized: true, unit: !2, retainedNodes: !4) -!15 = !DISubroutineType(types: !16) -!16 = !{!8} -!17 = !DILocation(line: 7, column: 10, scope: !14) -!18 = !DILocation(line: 7, column: 3, scope: !14) -!19 = distinct !DISubprogram(name: "bar", scope: !3, file: !3, line: 10, type: !15, isLocal: false, isDefinition: true, scopeLine: 10, isOptimized: true, unit: !2, retainedNodes: !4) -!20 = !DILocation(line: 11, column: 10, scope: !19) -!21 = !DILocation(line: 11, column: 3, scope: !19) -!22 = distinct !DISubprogram(name: "baz", scope: !3, file: !3, line: 14, type: !23, isLocal: false, isDefinition: true, scopeLine: 14, isOptimized: true, unit: !2, retainedNodes: !4) -!23 = !DISubroutineType(types: !24) -!24 = !{null} -!25 = !DILocation(line: 15, column: 10, scope: !22) -!26 = !DILocation(line: 15, column: 8, scope: !22) -!27 = !DILocation(line: 16, column: 10, scope: !22) -!28 = !DILocation(line: 16, column: 8, scope: !22) -!29 = !DILocation(line: 17, column: 1, scope: !22) diff --git a/llvm/test/ThinLTO/X86/dot-dumper.ll b/llvm/test/ThinLTO/X86/dot-dumper.ll index 7578212ec44..72175a1ea4d 100644 --- a/llvm/test/ThinLTO/X86/dot-dumper.ll +++ b/llvm/test/ThinLTO/X86/dot-dumper.ll @@ -20,7 +20,7 @@ ; STRUCTURE-DAG: subgraph cluster_1 ; STRUCTURE: // Cross-module edges: ; STRUCTURE-DAG: M0_{{[0-9]+}} -> M1_{{[0-9]+}} // call -; STRUCTURE-DAG: M0_{{[0-9]+}} -> M1_{{[0-9]+}} [{{.*}}]; // const-ref +; STRUCTURE-DAG: M0_{{[0-9]+}} -> M1_{{[0-9]+}} [{{.*}}]; // ref ; STRUCTURE-NEXT: } ; CLUSTER0: // Module: {{.*}}1.bc @@ -33,13 +33,13 @@ ; CLUSTER1: // Module: {{.*}}2.bc ; CLUSTER1-NEXT: subgraph cluster_1 { -; CLUSTER1-DAG: M1_[[A:[0-9]+]] [{{.*}}A|extern{{.*}}]; // variable, immutable +; CLUSTER1-DAG: M1_[[A:[0-9]+]] [{{.*}}A|extern{{.*}}]; // variable ; CLUSTER1-DAG: M1_[[FOO:[0-9]+]] [{{.*}}foo|extern{{.*}} ffl: 00001{{.*}}]; // function -; CLUSTER1-DAG: M1_[[B:[0-9]+]] [{{.*}}B|extern{{.*}}]; // variable, immutable +; CLUSTER1-DAG: M1_[[B:[0-9]+]] [{{.*}}B|extern{{.*}}]; // variable ; CLUSTER1-DAG: M1_[[BAR:[0-9]+]] [{{.*}}bar|extern{{.*}}]; // function, dead ; CLUSTER1-NEXT: // Edges: -; CLUSTER1-DAG: M1_[[FOO]] -> M1_[[B]] [{{.*}}]; // const-ref -; CLUSTER1-DAG: M1_[[FOO]] -> M1_[[A]] [{{.*}}]; // const-ref +; CLUSTER1-DAG: M1_[[FOO]] -> M1_[[B]] [{{.*}}]; // ref +; CLUSTER1-DAG: M1_[[FOO]] -> M1_[[A]] [{{.*}}]; // ref ; CLUSTER1-DAG: } target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/llvm/test/ThinLTO/X86/globals-import-const-fold.ll b/llvm/test/ThinLTO/X86/globals-import-const-fold.ll index a250ed2e92b..49e31b79a47 100644 --- a/llvm/test/ThinLTO/X86/globals-import-const-fold.ll +++ b/llvm/test/ThinLTO/X86/globals-import-const-fold.ll @@ -2,12 +2,12 @@ ; RUN: opt -module-summary %p/Inputs/globals-import-cf-baz.ll -o %t2.bc ; RUN: llvm-lto -thinlto-action=thinlink %t1.bc %t2.bc -o %t3.index.bc -; RUN: llvm-lto -thinlto-action=import -exported-symbol=main %t1.bc -thinlto-index=%t3.index.bc +; RUN: llvm-lto -thinlto-action=import %t1.bc %t2.bc -thinlto-index=%t3.index.bc ; RUN: llvm-dis %t1.bc.thinlto.imported.bc -o - | FileCheck --check-prefix=IMPORT %s ; RUN: llvm-lto -thinlto-action=optimize %t1.bc.thinlto.imported.bc -o %t1.bc.thinlto.opt.bc ; RUN: llvm-dis %t1.bc.thinlto.opt.bc -o - | FileCheck --check-prefix=OPTIMIZE %s -; IMPORT: @baz = internal local_unnamed_addr constant i32 10 +; IMPORT: @baz = available_externally local_unnamed_addr constant i32 10 ; OPTIMIZE: define i32 @main() ; OPTIMIZE-NEXT: ret i32 10 diff --git a/llvm/test/ThinLTO/X86/index-const-prop-O0.ll b/llvm/test/ThinLTO/X86/index-const-prop-O0.ll deleted file mode 100644 index 6426d726843..00000000000 --- a/llvm/test/ThinLTO/X86/index-const-prop-O0.ll +++ /dev/null @@ -1,18 +0,0 @@ -; RUN: opt -module-summary %s -o %t1.bc -; RUN: opt -module-summary %p/Inputs/index-const-prop-define-g.ll -o %t2.bc -; RUN: llvm-lto2 run -O0 -save-temps %t2.bc -r=%t2.bc,g,pl %t1.bc -r=%t1.bc,main,plx -r=%t1.bc,g, -o %t3 -; RUN: llvm-dis %t3.1.3.import.bc -o - | FileCheck %s - -; With -O0 import is disabled so we must not internalize -; read-only globals -; CHECK: @g = dso_local global i32 42 - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@g = external global i32 - -define i32 @main() { - %v = load i32, i32* @g - ret i32 %v -} diff --git a/llvm/test/ThinLTO/X86/index-const-prop-alias.ll b/llvm/test/ThinLTO/X86/index-const-prop-alias.ll deleted file mode 100644 index 592fc9e081a..00000000000 --- a/llvm/test/ThinLTO/X86/index-const-prop-alias.ll +++ /dev/null @@ -1,42 +0,0 @@ -; RUN: opt -module-summary %s -o %t1.bc -; RUN: opt -module-summary %p/Inputs/index-const-prop-alias.ll -o %t2.bc -; RUN: llvm-lto2 run %t1.bc -r=%t1.bc,main,plx -r=%t1.bc,ret_ptr,pl -r=%t1.bc,g.alias,l -r=%t1.bc,g,l \ -; RUN: %t2.bc -r=%t2.bc,g,pl -r=%t2.bc,g.alias,pl -save-temps -o %t3 -; RUN: llvm-dis %t3.1.3.import.bc -o - | FileCheck %s --check-prefix=IMPORT -; RUN: llvm-dis %t3.1.5.precodegen.bc -o - | FileCheck %s --check-prefix=CODEGEN - -; When ret_ptr is preserved we return pointer to alias, so we can't internalize aliasee -; RUN: llvm-lto2 run %t1.bc -r=%t1.bc,main,plx -r=%t1.bc,ret_ptr,plx -r=%t1.bc,g.alias,l -r=%t1.bc,g,l \ -; RUN: %t2.bc -r=%t2.bc,g,pl -r=%t2.bc,g.alias,pl -save-temps -o %t4 -; RUN: llvm-dis %t4.1.3.import.bc -o - | FileCheck %s --check-prefix=PRESERVED - -; When g.alias is preserved we can't internalize aliasee either -; RUN: llvm-lto2 run %t1.bc -r=%t1.bc,main,plx -r=%t1.bc,ret_ptr,pl -r=%t1.bc,g.alias,l -r=%t1.bc,g,l \ -; RUN: %t2.bc -r=%t2.bc,g,pl -r=%t2.bc,g.alias,plx -save-temps -o %t5 -; RUN: llvm-dis %t5.1.3.import.bc -o - | FileCheck %s --check-prefix=PRESERVED - -; We currently don't support importing aliases -; IMPORT: @g.alias = external dso_local global i32 -; IMPORT-NEXT: @g = internal global i32 42, align 4 #0 -; IMPORT: attributes #0 = { "thinlto-internalize" } - -; CODEGEN: define dso_local i32 @main -; CODEGEN-NEXT: ret i32 42 - -; PRESERVED: @g.alias = external dso_local global i32 -; PRESERVED-NEXT: @g = available_externally dso_local global i32 42, align 4 - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@g.alias = external global i32 -@g = external global i32 - -define i32 @main() { - %v = load i32, i32* @g - ret i32 %v -} - -define i32* @ret_ptr() { - ret i32* @g.alias -} diff --git a/llvm/test/ThinLTO/X86/index-const-prop-comdat.ll b/llvm/test/ThinLTO/X86/index-const-prop-comdat.ll deleted file mode 100644 index e05aaf98d7f..00000000000 --- a/llvm/test/ThinLTO/X86/index-const-prop-comdat.ll +++ /dev/null @@ -1,17 +0,0 @@ -; RUN: opt -module-summary %s -o %t1.bc -; RUN: opt -module-summary %p/Inputs/index-const-prop-comdat.ll -o %t2.bc -; RUN: llvm-lto2 run -save-temps %t2.bc -r=%t2.bc,g,pl %t1.bc -r=%t1.bc,main,plx -r=%t1.bc,g, -o %t3 -; RUN: llvm-dis %t3.2.3.import.bc -o - | FileCheck %s - -; Comdats are not internalized even if they are read only. -; CHECK: @g = available_externally dso_local global i32 42 - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@g = external global i32 - -define i32 @main() { - %v = load i32, i32* @g - ret i32 %v -} diff --git a/llvm/test/ThinLTO/X86/index-const-prop-dead.ll b/llvm/test/ThinLTO/X86/index-const-prop-dead.ll deleted file mode 100644 index f3ffca8cbdf..00000000000 --- a/llvm/test/ThinLTO/X86/index-const-prop-dead.ll +++ /dev/null @@ -1,26 +0,0 @@ -; RUN: opt -module-summary %s -o %t1.bc -; RUN: opt -module-summary %p/Inputs/index-const-prop-define-g.ll -o %t2.bc -; RUN: llvm-lto2 run -save-temps %t2.bc -r=%t2.bc,g,pl \ -; RUN: %t1.bc -r=%t1.bc,main,plx -r=%t1.bc,foo,pl -r=%t1.bc,g, -o %t3 -; RUN: llvm-dis %t3.2.3.import.bc -o - | FileCheck %s - -; Dead globals are converted to declarations by ThinLTO in dropDeadSymbols -; If we try to internalize such we'll get a broken module. -; CHECK: @g = external dso_local global i32 - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@g = external global i32 - -; We need at least one live symbol to enable dead stripping -; Otherwise ModuleSummaryIndex::isGlobalValueLive will always -; return true. -define i32 @main() { - ret i32 42 -} - -define i32 @foo() { - %v = load i32, i32* @g - ret i32 %v -} diff --git a/llvm/test/ThinLTO/X86/index-const-prop-full-lto.ll b/llvm/test/ThinLTO/X86/index-const-prop-full-lto.ll deleted file mode 100644 index 26fe4d644b7..00000000000 --- a/llvm/test/ThinLTO/X86/index-const-prop-full-lto.ll +++ /dev/null @@ -1,24 +0,0 @@ -; RUN: opt -module-summary %s -o %t1.bc -; RUN: opt -module-summary %p/Inputs/index-const-prop-define-g.ll -o %t2.bc -; RUN: opt -module-summary %p/Inputs/index-const-prop-full-lto.ll -o %t3.bc -; RUN: llvm-lto2 run -save-temps %t2.bc -r=%t2.bc,g,pl \ -; RUN: %t1.bc -r=%t1.bc,foo,l -r=%t1.bc,main,plx -r=%t1.bc,g, \ -; RUN: %t3.bc -r=%t3.bc,foo,pl -r=%t3.bc,g, -o %t4 -; RUN: llvm-dis %t4.2.3.import.bc -o - | FileCheck %s - -; All references from functions in full LTO module are not constant. -; We cannot internalize @g -; CHECK: @g = available_externally dso_local global i32 42 - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -declare i32 @foo() -@g = external global i32 - -define i32 @main() { - %v = call i32 @foo() - %v2 = load i32, i32* @g - %v3 = add i32 %v, %v2 - ret i32 %v3 -} diff --git a/llvm/test/ThinLTO/X86/index-const-prop-gvref.ll b/llvm/test/ThinLTO/X86/index-const-prop-gvref.ll deleted file mode 100644 index 87103fee141..00000000000 --- a/llvm/test/ThinLTO/X86/index-const-prop-gvref.ll +++ /dev/null @@ -1,27 +0,0 @@ -; RUN: opt -module-summary %s -o %t1.bc -; RUN: opt -module-summary %p/Inputs/index-const-prop-gvref.ll -o %t2.bc -; RUN: llvm-lto2 run -save-temps %t2.bc -r=%t2.bc,b,pl -r=%t2.bc,a,pl \ -; RUN: %t1.bc -r=%t1.bc,main,plx -r=%t1.bc,a, -r=%t1.bc,b, -o %t3 -; RUN: llvm-dis %t3.1.3.import.bc -o - | FileCheck %s --check-prefix=SRC -; RUN: llvm-dis %t3.2.3.import.bc -o - | FileCheck %s --check-prefix=DEST - -; No variable in the source module should have been internalized -; SRC: @b = dso_local global i32* @a -; SRC-NEXT: @a = dso_local global i32 42 - -; We can't internalize globals referenced by other live globals -; DEST: @b = external dso_local global i32* -; DEST-NEXT: @a = available_externally dso_local global i32 42, align 4 - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@a = external global i32 -@b = external global i32* - -define i32 @main() { - %p = load i32*, i32** @b, align 8 - store i32 33, i32* %p, align 4 - %v = load i32, i32* @a, align 4 - ret i32 %v -} diff --git a/llvm/test/ThinLTO/X86/index-const-prop-ldst.ll b/llvm/test/ThinLTO/X86/index-const-prop-ldst.ll deleted file mode 100644 index 4646557b6cf..00000000000 --- a/llvm/test/ThinLTO/X86/index-const-prop-ldst.ll +++ /dev/null @@ -1,21 +0,0 @@ -; RUN: opt -module-summary %s -o %t1.bc -; RUN: opt -module-summary %p/Inputs/index-const-prop-define-g.ll -o %t2.bc -; RUN: llvm-lto2 run -save-temps %t2.bc -r=%t2.bc,g,pl %t1.bc -r=%t1.bc,main,plx -r=%t1.bc,g, -o %t3 -; RUN: llvm-dis %t3.2.3.import.bc -o - | FileCheck %s - -; The 'store' instruction in @main should prevent internalization -; even when there is 'load' instruction before it. -; CHECK: @g = available_externally dso_local global i32 42 - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@g = external global i32 - -define i32 @main() { - %v = load i32, i32* @g - %q = add i32 %v, 1 - store i32 %q, i32* @g - - ret i32 %v -} diff --git a/llvm/test/ThinLTO/X86/index-const-prop-linkage.ll b/llvm/test/ThinLTO/X86/index-const-prop-linkage.ll deleted file mode 100644 index aac91772111..00000000000 --- a/llvm/test/ThinLTO/X86/index-const-prop-linkage.ll +++ /dev/null @@ -1,27 +0,0 @@ -; RUN: opt -module-summary %s -o %t1.bc -; RUN: opt -module-summary %p/Inputs/index-const-prop-linkage.ll -o %t2.bc -; RUN: llvm-lto2 run -save-temps %t2.bc -r=%t2.bc,foo,pl -r=%t2.bc,g1,pl -r=%t2.bc,g2,pl -r=%t2.bc,g3, \ -; RUN: %t1.bc -r=%t1.bc,foo, -r=%t1.bc,main,plx -r=%t1.bc,g2, -o %t3 -; RUN: llvm-dis %t3.2.3.import.bc -o - | FileCheck %s - -; Check that we never internalize anything with: -; - appending linkage -; - common linkage -; - available_externally linkage -; - reference from @llvm.used -; CHECK: @llvm.used = appending global [1 x i32*] [i32* @g2] -; CHECK-NEXT: @g1 = external dso_local global i32, align 4 -; CHECK-NEXT: @g2 = available_externally dso_local global i32 42, align 4 -; CHECK-NEXT: @g3 = available_externally global i32 42, align 4 - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -declare i32 @foo() -@g2 = external global i32 -@llvm.used = appending global [1 x i32*] [i32* @g2] - -define i32 @main() { - %v = call i32 @foo() - ret i32 %v -} diff --git a/llvm/test/ThinLTO/X86/index-const-prop.ll b/llvm/test/ThinLTO/X86/index-const-prop.ll deleted file mode 100644 index df99d83fbb5..00000000000 --- a/llvm/test/ThinLTO/X86/index-const-prop.ll +++ /dev/null @@ -1,40 +0,0 @@ -; Check constant propagation in thinlto combined summary. This allows us to do 2 things: -; 1. Internalize global definition which is not used externally if all accesses to it are read-only -; 2. Make a local copy of internal definition if all accesses to it are readonly. This allows constant -; folding it during optimziation phase. - -; RUN: opt -module-summary %s -o %t1.bc -; RUN: opt -module-summary %p/Inputs/index-const-prop.ll -o %t2.bc -; RUN: llvm-lto -thinlto-action=thinlink -o %t3.index.bc %t1.bc %t2.bc -; RUN: llvm-lto -thinlto-action=import -exported-symbol=main %t1.bc -thinlto-index=%t3.index.bc -o %t1.imported.bc -; RUN: llvm-dis %t1.imported.bc -o - | FileCheck %s --check-prefix=IMPORT -; RUN: llvm-lto -thinlto-action=optimize %t1.imported.bc -o - | llvm-dis - -o - | FileCheck %s --check-prefix=OPTIMIZE - -; Check that we don't internalize gBar when it is exported -; RUN: llvm-lto -thinlto-action=import -exported-symbol main -exported-symbol gBar %t1.bc -thinlto-index=%t3.index.bc -o %t1.imported2.bc -; RUN: llvm-dis %t1.imported2.bc -o - | FileCheck %s --check-prefix=IMPORT2 - -; IMPORT: @gFoo.llvm.0 = internal unnamed_addr global i32 1, align 4, !dbg !0 -; IMPORT-NEXT: @gBar = internal local_unnamed_addr global i32 2, align 4, !dbg !5 -; IMPORT: !DICompileUnit({{.*}}, globals: !{{[0-9]+}}) - -; OPTIMIZE: define i32 @main -; OPTIMIZE-NEXT: ret i32 3 - -; IMPORT2: @gBar = available_externally local_unnamed_addr global i32 2, align 4, !dbg !5 - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-pc-linux-gnu" - -@gBar = external global i32 - -define i32 @main() local_unnamed_addr { - %call = tail call i32 bitcast (i32 (...)* @foo to i32 ()*)() - %call1 = tail call i32 bitcast (i32 (...)* @bar to i32 ()*)() - %add = add nsw i32 %call1, %call - ret i32 %add -} - -declare i32 @foo(...) local_unnamed_addr - -declare i32 @bar(...) local_unnamed_addr diff --git a/llvm/test/ThinLTO/X86/index-const-prop2.ll b/llvm/test/ThinLTO/X86/index-const-prop2.ll deleted file mode 100644 index d6c8ec80661..00000000000 --- a/llvm/test/ThinLTO/X86/index-const-prop2.ll +++ /dev/null @@ -1,59 +0,0 @@ -; Check constant propagation in thinlto combined summary. This allows us to do 2 things: -; 1. Internalize global definition which is not used externally if all accesses to it are read-only -; 2. Make a local copy of internal definition if all accesses to it are readonly. This allows constant -; folding it during optimziation phase. -; RUN: opt -module-summary %s -o %t1.bc -; RUN: opt -module-summary %p/Inputs/index-const-prop.ll -o %t2.bc -; RUN: llvm-lto2 run %t1.bc %t2.bc -save-temps \ -; RUN: -r=%t2.bc,foo,pl \ -; RUN: -r=%t2.bc,bar,pl \ -; RUN: -r=%t2.bc,baz,pl \ -; RUN: -r=%t2.bc,rand, \ -; RUN: -r=%t2.bc,gBar,pl \ -; RUN: -r=%t1.bc,main,plx \ -; RUN: -r=%t1.bc,foo, \ -; RUN: -r=%t1.bc,bar, \ -; RUN: -r=%t1.bc,gBar, \ -; RUN: -o %t3 -; RUN: llvm-dis %t3.1.3.import.bc -o - | FileCheck %s --check-prefix=IMPORT -; RUN: llvm-dis %t3.1.5.precodegen.bc -o - | FileCheck %s --check-prefix=CODEGEN - -; Now check that we won't internalize global (gBar) if it's externally referenced -; RUN: llvm-lto2 run %t1.bc %t2.bc -save-temps \ -; RUN: -r=%t2.bc,foo,pl \ -; RUN: -r=%t2.bc,bar,pl \ -; RUN: -r=%t2.bc,baz,pl \ -; RUN: -r=%t2.bc,rand, \ -; RUN: -r=%t2.bc,gBar,plx \ -; RUN: -r=%t1.bc,main,plx \ -; RUN: -r=%t1.bc,foo, \ -; RUN: -r=%t1.bc,bar, \ -; RUN: -r=%t1.bc,gBar, \ -; RUN: -o %t3 -; RUN: llvm-dis %t3.1.3.import.bc -o - | FileCheck %s --check-prefix=IMPORT2 - -; IMPORT: @gFoo.llvm.0 = internal unnamed_addr global i32 1, align 4 -; IMPORT-NEXT: @gBar = internal local_unnamed_addr global i32 2, align 4 -; IMPORT: !DICompileUnit({{.*}}, globals: !{{[0-9]+}}) - -; CODEGEN: i32 @main() -; CODEGEN-NEXT: ret i32 3 - -; IMPORT2: @gBar = available_externally dso_local local_unnamed_addr global i32 2, align 4 - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-pc-linux-gnu" - -; We should be able to link external definition of gBar to its declaration -@gBar = external global i32 - -define i32 @main() local_unnamed_addr { - %call = tail call i32 bitcast (i32 (...)* @foo to i32 ()*)() - %call1 = tail call i32 bitcast (i32 (...)* @bar to i32 ()*)() - %add = add nsw i32 %call1, %call - ret i32 %add -} - -declare i32 @foo(...) local_unnamed_addr - -declare i32 @bar(...) local_unnamed_addr |

