From 4ca4bcedf16a71f7cd111fb285abdeb9478af38b Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Wed, 14 Dec 2016 21:57:04 +0000 Subject: [PATCH] [LTO] Reject modules without datalayout. Also, udpate the ~60 failing tests in the tree which did not contain a valid datalayout. This fixes PR31123. lld will be updated in a following patch, immediately after this is committed. Differential Revision: https://reviews.llvm.org/D27082 llvm-svn: 289719 --- lib/LTO/LTO.cpp | 5 +++++ lib/LTO/LTOBackend.cpp | 1 - lib/LTO/LTOModule.cpp | 1 - test/LTO/Resolution/X86/Inputs/common2.ll | 5 +++-- test/LTO/Resolution/X86/Inputs/mixed_lto.ll | 1 + test/LTO/Resolution/X86/common2.ll | 5 ++--- test/LTO/Resolution/X86/mixed_lto.ll | 1 + .../X86/diagnostic-handler-remarks-with-hotness.ll | 1 + test/LTO/X86/diagnostic-handler-remarks.ll | 1 + test/LTO/X86/no-undefined-puts-when-implemented.ll | 1 + test/LTO/X86/triple-init.ll | 3 +-- test/ThinLTO/X86/Inputs/distributed_import.ll | 2 ++ test/ThinLTO/X86/distributed_import.ll | 2 ++ test/tools/gold/X86/Inputs/alias-1.ll | 2 ++ test/tools/gold/X86/Inputs/available-externally.ll | 2 ++ test/tools/gold/X86/Inputs/cache.ll | 1 + test/tools/gold/X86/Inputs/comdat.ll | 2 ++ test/tools/gold/X86/Inputs/comdat2.ll | 2 ++ test/tools/gold/X86/Inputs/common.ll | 2 ++ test/tools/gold/X86/Inputs/common2.ll | 2 ++ test/tools/gold/X86/Inputs/common3.ll | 2 ++ test/tools/gold/X86/Inputs/ctors2.ll | 2 ++ test/tools/gold/X86/Inputs/drop-linkage.ll | 2 ++ test/tools/gold/X86/Inputs/irmover-error.ll | 2 ++ test/tools/gold/X86/Inputs/linkonce-weak.ll | 2 ++ test/tools/gold/X86/Inputs/mixed_lto.ll | 1 + test/tools/gold/X86/Inputs/pr19901-1.ll | 1 + test/tools/gold/X86/Inputs/resolve-to-alias.ll | 2 ++ test/tools/gold/X86/Inputs/start-lib-common.ll | 2 ++ test/tools/gold/X86/Inputs/thinlto.ll | 2 ++ test/tools/gold/X86/Inputs/thinlto_alias.ll | 1 + test/tools/gold/X86/Inputs/thinlto_archive1.ll | 2 ++ test/tools/gold/X86/Inputs/thinlto_archive2.ll | 2 ++ test/tools/gold/X86/Inputs/thinlto_empty.ll | 1 + test/tools/gold/X86/Inputs/thinlto_internalize.ll | 1 + .../gold/X86/Inputs/thinlto_linkonceresolution.ll | 1 + .../gold/X86/Inputs/thinlto_weak_resolution.ll | 1 + test/tools/gold/X86/Inputs/type-merge.ll | 2 ++ test/tools/gold/X86/Inputs/type-merge2.ll | 2 ++ test/tools/gold/X86/Inputs/visibility.ll | 2 ++ test/tools/gold/X86/Inputs/weak.ll | 2 ++ test/tools/gold/X86/alias.ll | 2 ++ test/tools/gold/X86/alias2.ll | 2 ++ test/tools/gold/X86/available-externally.ll | 2 ++ test/tools/gold/X86/bad-alias.ll | 2 ++ test/tools/gold/X86/bcsection.ll | 1 + test/tools/gold/X86/cache.ll | 1 + test/tools/gold/X86/coff.ll | 2 +- test/tools/gold/X86/comdat.ll | 2 ++ test/tools/gold/X86/comdat2.ll | 1 + test/tools/gold/X86/common.ll | 2 ++ test/tools/gold/X86/ctors.ll | 2 ++ test/tools/gold/X86/ctors2.ll | 2 ++ test/tools/gold/X86/disable-verify.ll | 1 + test/tools/gold/X86/drop-linkage.ll | 2 ++ test/tools/gold/X86/emit-llvm.ll | 1 + test/tools/gold/X86/irmover-error.ll | 2 ++ test/tools/gold/X86/linker-script.ll | 2 ++ test/tools/gold/X86/linkonce-weak.ll | 2 ++ test/tools/gold/X86/mixed_lto.ll | 1 + test/tools/gold/X86/no-map-whole-file.ll | 3 +++ test/tools/gold/X86/opt-level.ll | 3 +++ test/tools/gold/X86/parallel.ll | 1 + test/tools/gold/X86/pr19901.ll | 1 + test/tools/gold/X86/pr19901_thinlto.ll | 1 + test/tools/gold/X86/pr25907.ll | 2 ++ test/tools/gold/X86/pr25915.ll | 2 ++ test/tools/gold/X86/relax-relocs.ll | 1 + test/tools/gold/X86/resolve-to-alias.ll | 2 ++ test/tools/gold/X86/slp-vectorize.ll | 1 + test/tools/gold/X86/start-lib-common.ll | 1 + test/tools/gold/X86/strip_names.ll | 2 ++ test/tools/gold/X86/thinlto.ll | 2 ++ test/tools/gold/X86/thinlto_alias.ll | 1 + test/tools/gold/X86/thinlto_archive.ll | 2 ++ test/tools/gold/X86/thinlto_emit_imports.ll | 2 ++ test/tools/gold/X86/thinlto_internalize.ll | 1 + test/tools/gold/X86/thinlto_linkonceresolution.ll | 1 + test/tools/gold/X86/thinlto_prefix_replace.ll | 2 ++ test/tools/gold/X86/thinlto_weak_resolution.ll | 1 + test/tools/gold/X86/type-merge.ll | 2 ++ test/tools/gold/X86/type-merge2.ll | 2 ++ test/tools/gold/X86/unnamed-addr.ll | 2 ++ test/tools/gold/X86/visibility.ll | 2 ++ test/tools/gold/X86/weak.ll | 2 ++ test/tools/llvm-lto/Inputs/thinlto.ll | 2 ++ test/tools/llvm-lto/thinlto.ll | 2 ++ test/tools/llvm-lto2/X86/nodatalayout.ll | 13 +++++++++++++ test/tools/llvm-lto2/X86/pipeline.ll | 1 + test/tools/llvm-lto2/errors.ll | 3 +++ 90 files changed, 162 insertions(+), 10 deletions(-) create mode 100644 test/tools/llvm-lto2/X86/nodatalayout.ll diff --git a/lib/LTO/LTO.cpp b/lib/LTO/LTO.cpp index 718cbf17048..74de6c18aef 100644 --- a/lib/LTO/LTO.cpp +++ b/lib/LTO/LTO.cpp @@ -380,6 +380,11 @@ Error LTO::addModule(InputFile &Input, InputFile::InputModule &IM, const SymbolResolution *ResE) { // FIXME: move to backend Module &M = *IM.Mod; + + if (M.getDataLayoutStr().empty()) + return make_error("input module has no datalayout", + inconvertibleErrorCode()); + if (!Conf.OverrideTriple.empty()) M.setTargetTriple(Conf.OverrideTriple); else if (M.getTargetTriple().empty()) diff --git a/lib/LTO/LTOBackend.cpp b/lib/LTO/LTOBackend.cpp index 9d4cbdde3ff..87338260998 100644 --- a/lib/LTO/LTOBackend.cpp +++ b/lib/LTO/LTOBackend.cpp @@ -191,7 +191,6 @@ static void runOldPMPasses(Config &Conf, Module &Mod, TargetMachine *TM, bool opt(Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod, bool IsThinLTO) { - Mod.setDataLayout(TM->createDataLayout()); if (Conf.OptPipeline.empty()) runOldPMPasses(Conf, Mod, TM, IsThinLTO); else diff --git a/lib/LTO/LTOModule.cpp b/lib/LTO/LTOModule.cpp index e61a10e5b9e..89aeb800003 100644 --- a/lib/LTO/LTOModule.cpp +++ b/lib/LTO/LTOModule.cpp @@ -233,7 +233,6 @@ LTOModule::makeLTOModule(MemoryBufferRef Buffer, const TargetOptions &options, TargetMachine *target = march->createTargetMachine(TripleStr, CPU, FeatureStr, options, None); - M->setDataLayout(target->createDataLayout()); std::unique_ptr Ret(new LTOModule(std::move(M), Buffer, target)); Ret->parseSymbols(); diff --git a/test/LTO/Resolution/X86/Inputs/common2.ll b/test/LTO/Resolution/X86/Inputs/common2.ll index 577e9977ac0..c3a7f753684 100644 --- a/test/LTO/Resolution/X86/Inputs/common2.ll +++ b/test/LTO/Resolution/X86/Inputs/common2.ll @@ -1,7 +1,8 @@ -target triple = "x86_64-apple-macosx10.11.0" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" @v = common global i16 0, align 4 define i16 *@bar() { ret i16 *@v -} \ No newline at end of file +} diff --git a/test/LTO/Resolution/X86/Inputs/mixed_lto.ll b/test/LTO/Resolution/X86/Inputs/mixed_lto.ll index 44e82c9fac7..2393deb3241 100644 --- a/test/LTO/Resolution/X86/Inputs/mixed_lto.ll +++ b/test/LTO/Resolution/X86/Inputs/mixed_lto.ll @@ -1,3 +1,4 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" declare i32 @g() define i32 @main() { diff --git a/test/LTO/Resolution/X86/common2.ll b/test/LTO/Resolution/X86/common2.ll index 4a6c95b7a14..3328d7c5ec3 100644 --- a/test/LTO/Resolution/X86/common2.ll +++ b/test/LTO/Resolution/X86/common2.ll @@ -70,9 +70,8 @@ ; RUN: -r %t2.bc,bar,px ; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=BOTH-PREVAILED2 - - -target triple = "x86_64-apple-macosx10.11.0" +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" @v = common global i8 0, align 8 diff --git a/test/LTO/Resolution/X86/mixed_lto.ll b/test/LTO/Resolution/X86/mixed_lto.ll index 0302ed990e0..02b15c61154 100644 --- a/test/LTO/Resolution/X86/mixed_lto.ll +++ b/test/LTO/Resolution/X86/mixed_lto.ll @@ -19,6 +19,7 @@ ; RUN: llvm-nm %t5.o.0 | FileCheck %s --check-prefix=NM0 ; RUN: llvm-nm %t5.o.1 | FileCheck %s --check-prefix=NM1 +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define i32 @g() { ret i32 0 diff --git a/test/LTO/X86/diagnostic-handler-remarks-with-hotness.ll b/test/LTO/X86/diagnostic-handler-remarks-with-hotness.ll index 8a7f4c81b9e..e5d53c7774a 100644 --- a/test/LTO/X86/diagnostic-handler-remarks-with-hotness.ll +++ b/test/LTO/X86/diagnostic-handler-remarks-with-hotness.ll @@ -19,6 +19,7 @@ ; YAML-NEXT: - Caller: main ; YAML-NEXT: ... +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-darwin" declare i32 @bar() diff --git a/test/LTO/X86/diagnostic-handler-remarks.ll b/test/LTO/X86/diagnostic-handler-remarks.ll index c9e6beb0ace..456bdb5419c 100644 --- a/test/LTO/X86/diagnostic-handler-remarks.ll +++ b/test/LTO/X86/diagnostic-handler-remarks.ll @@ -54,6 +54,7 @@ ; YAML-NEXT: - Caller: main ; YAML-NEXT: ... +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-darwin" declare i32 @bar() diff --git a/test/LTO/X86/no-undefined-puts-when-implemented.ll b/test/LTO/X86/no-undefined-puts-when-implemented.ll index 132ec671d5b..51e5eabd03f 100644 --- a/test/LTO/X86/no-undefined-puts-when-implemented.ll +++ b/test/LTO/X86/no-undefined-puts-when-implemented.ll @@ -5,6 +5,7 @@ ; rdar://problem/16165191 ; runtime library implementations should not be renamed +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-darwin11" @str = private unnamed_addr constant [13 x i8] c"hello world\0A\00" diff --git a/test/LTO/X86/triple-init.ll b/test/LTO/X86/triple-init.ll index e0ad87967ba..7e45952b4e0 100644 --- a/test/LTO/X86/triple-init.ll +++ b/test/LTO/X86/triple-init.ll @@ -2,8 +2,7 @@ ; RUN: llvm-lto -exported-symbol=_main -o %t2 %t1 ; RUN: llvm-nm %t2 | FileCheck %s -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" - +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.9" declare double @pow(double, double) diff --git a/test/ThinLTO/X86/Inputs/distributed_import.ll b/test/ThinLTO/X86/Inputs/distributed_import.ll index 759c3371434..818c1ff3f8e 100644 --- a/test/ThinLTO/X86/Inputs/distributed_import.ll +++ b/test/ThinLTO/X86/Inputs/distributed_import.ll @@ -1,3 +1,5 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @G = internal global i32 7 define i32 @g() { entry: diff --git a/test/ThinLTO/X86/distributed_import.ll b/test/ThinLTO/X86/distributed_import.ll index b1ffd51359d..0a3f9c07f25 100644 --- a/test/ThinLTO/X86/distributed_import.ll +++ b/test/ThinLTO/X86/distributed_import.ll @@ -11,6 +11,8 @@ ; RUN: llvm-dis -o - %t2.out | FileCheck %s ; CHECK: @G.llvm.0 +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + declare i32 @g(...) define void @f() { diff --git a/test/tools/gold/X86/Inputs/alias-1.ll b/test/tools/gold/X86/Inputs/alias-1.ll index 96183aa9537..58d220ef2be 100644 --- a/test/tools/gold/X86/Inputs/alias-1.ll +++ b/test/tools/gold/X86/Inputs/alias-1.ll @@ -1 +1,3 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @a = global i32 42 diff --git a/test/tools/gold/X86/Inputs/available-externally.ll b/test/tools/gold/X86/Inputs/available-externally.ll index cbc5c12c65d..ae2a360d74a 100644 --- a/test/tools/gold/X86/Inputs/available-externally.ll +++ b/test/tools/gold/X86/Inputs/available-externally.ll @@ -1,3 +1,5 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + define void @zed() { ret void } diff --git a/test/tools/gold/X86/Inputs/cache.ll b/test/tools/gold/X86/Inputs/cache.ll index 39fa05a23c6..4abbb457137 100644 --- a/test/tools/gold/X86/Inputs/cache.ll +++ b/test/tools/gold/X86/Inputs/cache.ll @@ -1,3 +1,4 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define i32 @main() { diff --git a/test/tools/gold/X86/Inputs/comdat.ll b/test/tools/gold/X86/Inputs/comdat.ll index 734115180ff..e70b7181566 100644 --- a/test/tools/gold/X86/Inputs/comdat.ll +++ b/test/tools/gold/X86/Inputs/comdat.ll @@ -1,3 +1,5 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + $c2 = comdat any $c1 = comdat any diff --git a/test/tools/gold/X86/Inputs/comdat2.ll b/test/tools/gold/X86/Inputs/comdat2.ll index 5b7f74cf0b2..20bc4bf023e 100644 --- a/test/tools/gold/X86/Inputs/comdat2.ll +++ b/test/tools/gold/X86/Inputs/comdat2.ll @@ -1,3 +1,5 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + $foo = comdat any @foo = global i8 1, comdat define void @zed() { diff --git a/test/tools/gold/X86/Inputs/common.ll b/test/tools/gold/X86/Inputs/common.ll index 48e03562370..8743e417144 100644 --- a/test/tools/gold/X86/Inputs/common.ll +++ b/test/tools/gold/X86/Inputs/common.ll @@ -1 +1,3 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @a = common global i32 0, align 4 diff --git a/test/tools/gold/X86/Inputs/common2.ll b/test/tools/gold/X86/Inputs/common2.ll index 0f309d88a00..a378063178f 100644 --- a/test/tools/gold/X86/Inputs/common2.ll +++ b/test/tools/gold/X86/Inputs/common2.ll @@ -1 +1,3 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @a = common global i8 0, align 16 diff --git a/test/tools/gold/X86/Inputs/common3.ll b/test/tools/gold/X86/Inputs/common3.ll index 21d79730bdd..aba9dc80ee5 100644 --- a/test/tools/gold/X86/Inputs/common3.ll +++ b/test/tools/gold/X86/Inputs/common3.ll @@ -1 +1,3 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @a = common global i8 0, align 1 diff --git a/test/tools/gold/X86/Inputs/ctors2.ll b/test/tools/gold/X86/Inputs/ctors2.ll index af1590eb277..c83ce43f117 100644 --- a/test/tools/gold/X86/Inputs/ctors2.ll +++ b/test/tools/gold/X86/Inputs/ctors2.ll @@ -1,3 +1,5 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @bar, i8* null }] define void @bar() { diff --git a/test/tools/gold/X86/Inputs/drop-linkage.ll b/test/tools/gold/X86/Inputs/drop-linkage.ll index 07530611433..0799e11d32d 100644 --- a/test/tools/gold/X86/Inputs/drop-linkage.ll +++ b/test/tools/gold/X86/Inputs/drop-linkage.ll @@ -1,3 +1,5 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + $foo = comdat any define linkonce void @foo() comdat { ret void diff --git a/test/tools/gold/X86/Inputs/irmover-error.ll b/test/tools/gold/X86/Inputs/irmover-error.ll index 1ed82c284a7..a509a9548de 100644 --- a/test/tools/gold/X86/Inputs/irmover-error.ll +++ b/test/tools/gold/X86/Inputs/irmover-error.ll @@ -1,3 +1,5 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + !0 = !{ i32 1, !"foo", i32 2 } !llvm.module.flags = !{ !0 } diff --git a/test/tools/gold/X86/Inputs/linkonce-weak.ll b/test/tools/gold/X86/Inputs/linkonce-weak.ll index db5185d72f2..1f480526e16 100644 --- a/test/tools/gold/X86/Inputs/linkonce-weak.ll +++ b/test/tools/gold/X86/Inputs/linkonce-weak.ll @@ -1,3 +1,5 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + define weak_odr void @f() !dbg !4 { ret void, !dbg !10 } diff --git a/test/tools/gold/X86/Inputs/mixed_lto.ll b/test/tools/gold/X86/Inputs/mixed_lto.ll index 44e82c9fac7..2393deb3241 100644 --- a/test/tools/gold/X86/Inputs/mixed_lto.ll +++ b/test/tools/gold/X86/Inputs/mixed_lto.ll @@ -1,3 +1,4 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" declare i32 @g() define i32 @main() { diff --git a/test/tools/gold/X86/Inputs/pr19901-1.ll b/test/tools/gold/X86/Inputs/pr19901-1.ll index 2f7153268ac..45fa7384b5d 100644 --- a/test/tools/gold/X86/Inputs/pr19901-1.ll +++ b/test/tools/gold/X86/Inputs/pr19901-1.ll @@ -1,3 +1,4 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define linkonce_odr hidden void @f() { ret void diff --git a/test/tools/gold/X86/Inputs/resolve-to-alias.ll b/test/tools/gold/X86/Inputs/resolve-to-alias.ll index eff02a6f4d1..3097ef9f5b0 100644 --- a/test/tools/gold/X86/Inputs/resolve-to-alias.ll +++ b/test/tools/gold/X86/Inputs/resolve-to-alias.ll @@ -1,3 +1,5 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @bar = alias void (), void ()* @zed define void @zed() { ret void diff --git a/test/tools/gold/X86/Inputs/start-lib-common.ll b/test/tools/gold/X86/Inputs/start-lib-common.ll index e8e53b8726d..9ba9e8e0843 100644 --- a/test/tools/gold/X86/Inputs/start-lib-common.ll +++ b/test/tools/gold/X86/Inputs/start-lib-common.ll @@ -1 +1,3 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @x = common global i32 0, align 8 diff --git a/test/tools/gold/X86/Inputs/thinlto.ll b/test/tools/gold/X86/Inputs/thinlto.ll index 4e0840f3691..b81de922b4d 100644 --- a/test/tools/gold/X86/Inputs/thinlto.ll +++ b/test/tools/gold/X86/Inputs/thinlto.ll @@ -1,3 +1,5 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + define void @g() { entry: ret void diff --git a/test/tools/gold/X86/Inputs/thinlto_alias.ll b/test/tools/gold/X86/Inputs/thinlto_alias.ll index 4cee11dfc77..c9ef035080b 100644 --- a/test/tools/gold/X86/Inputs/thinlto_alias.ll +++ b/test/tools/gold/X86/Inputs/thinlto_alias.ll @@ -1,3 +1,4 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define weak void @weakfunc() { entry: diff --git a/test/tools/gold/X86/Inputs/thinlto_archive1.ll b/test/tools/gold/X86/Inputs/thinlto_archive1.ll index 4e0840f3691..b81de922b4d 100644 --- a/test/tools/gold/X86/Inputs/thinlto_archive1.ll +++ b/test/tools/gold/X86/Inputs/thinlto_archive1.ll @@ -1,3 +1,5 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + define void @g() { entry: ret void diff --git a/test/tools/gold/X86/Inputs/thinlto_archive2.ll b/test/tools/gold/X86/Inputs/thinlto_archive2.ll index a95d912ea5c..c2bda1712a4 100644 --- a/test/tools/gold/X86/Inputs/thinlto_archive2.ll +++ b/test/tools/gold/X86/Inputs/thinlto_archive2.ll @@ -1,3 +1,5 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + define void @h() { entry: ret void diff --git a/test/tools/gold/X86/Inputs/thinlto_empty.ll b/test/tools/gold/X86/Inputs/thinlto_empty.ll index e69de29bb2d..70bb58e5eeb 100644 --- a/test/tools/gold/X86/Inputs/thinlto_empty.ll +++ b/test/tools/gold/X86/Inputs/thinlto_empty.ll @@ -0,0 +1 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" diff --git a/test/tools/gold/X86/Inputs/thinlto_internalize.ll b/test/tools/gold/X86/Inputs/thinlto_internalize.ll index 44e82c9fac7..2393deb3241 100644 --- a/test/tools/gold/X86/Inputs/thinlto_internalize.ll +++ b/test/tools/gold/X86/Inputs/thinlto_internalize.ll @@ -1,3 +1,4 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" declare i32 @g() define i32 @main() { diff --git a/test/tools/gold/X86/Inputs/thinlto_linkonceresolution.ll b/test/tools/gold/X86/Inputs/thinlto_linkonceresolution.ll index 2f7153268ac..45fa7384b5d 100644 --- a/test/tools/gold/X86/Inputs/thinlto_linkonceresolution.ll +++ b/test/tools/gold/X86/Inputs/thinlto_linkonceresolution.ll @@ -1,3 +1,4 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define linkonce_odr hidden void @f() { ret void diff --git a/test/tools/gold/X86/Inputs/thinlto_weak_resolution.ll b/test/tools/gold/X86/Inputs/thinlto_weak_resolution.ll index 86e2ce357b8..0f817d7db3a 100644 --- a/test/tools/gold/X86/Inputs/thinlto_weak_resolution.ll +++ b/test/tools/gold/X86/Inputs/thinlto_weak_resolution.ll @@ -1,3 +1,4 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" ; Alias are not optimized diff --git a/test/tools/gold/X86/Inputs/type-merge.ll b/test/tools/gold/X86/Inputs/type-merge.ll index 4dc214922dc..6e94bc08d41 100644 --- a/test/tools/gold/X86/Inputs/type-merge.ll +++ b/test/tools/gold/X86/Inputs/type-merge.ll @@ -1,3 +1,5 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + define void @zed() { call void @bar() ret void diff --git a/test/tools/gold/X86/Inputs/type-merge2.ll b/test/tools/gold/X86/Inputs/type-merge2.ll index a354757ee2e..7cdea6e82f3 100644 --- a/test/tools/gold/X86/Inputs/type-merge2.ll +++ b/test/tools/gold/X86/Inputs/type-merge2.ll @@ -1,3 +1,5 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + %zed = type { i16 } define void @bar(%zed* %this) { store %zed* %this, %zed** null diff --git a/test/tools/gold/X86/Inputs/visibility.ll b/test/tools/gold/X86/Inputs/visibility.ll index b758d4a0c08..42796a97bc8 100644 --- a/test/tools/gold/X86/Inputs/visibility.ll +++ b/test/tools/gold/X86/Inputs/visibility.ll @@ -1,3 +1,5 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + define void @foo() { ret void } diff --git a/test/tools/gold/X86/Inputs/weak.ll b/test/tools/gold/X86/Inputs/weak.ll index 53b1d1650d1..5209d343f23 100644 --- a/test/tools/gold/X86/Inputs/weak.ll +++ b/test/tools/gold/X86/Inputs/weak.ll @@ -1,2 +1,4 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @a = weak global i32 41 @c = global i32* @a diff --git a/test/tools/gold/X86/alias.ll b/test/tools/gold/X86/alias.ll index c659f73d7e8..98333422303 100644 --- a/test/tools/gold/X86/alias.ll +++ b/test/tools/gold/X86/alias.ll @@ -9,5 +9,7 @@ ; CHECK-NEXT: @b = global i32 1 ; CHECK-NOT: alias +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @a = weak alias i32, i32* @b @b = global i32 1 diff --git a/test/tools/gold/X86/alias2.ll b/test/tools/gold/X86/alias2.ll index 4727e0508fa..3beecd4190d 100644 --- a/test/tools/gold/X86/alias2.ll +++ b/test/tools/gold/X86/alias2.ll @@ -2,6 +2,8 @@ ; RUN: %gold -shared -o %t2.bc -plugin %llvmshlibdir/LLVMgold.so %t.o -plugin-opt=emit-llvm ; RUN: llvm-dis %t2.bc -o - | FileCheck %s +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @bar = alias void (), void ()* @zed define void @foo() { call void @bar() diff --git a/test/tools/gold/X86/available-externally.ll b/test/tools/gold/X86/available-externally.ll index d47a536dc09..f01f45de21f 100644 --- a/test/tools/gold/X86/available-externally.ll +++ b/test/tools/gold/X86/available-externally.ll @@ -11,6 +11,8 @@ ; RUN: -shared %t2.o %t.o -o %t3.o ; RUN: llvm-dis %t3.o -o - | FileCheck %s +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + define void @foo() { call void @bar() call void @zed() diff --git a/test/tools/gold/X86/bad-alias.ll b/test/tools/gold/X86/bad-alias.ll index c4e3c3fe82f..2a09f69c6e1 100644 --- a/test/tools/gold/X86/bad-alias.ll +++ b/test/tools/gold/X86/bad-alias.ll @@ -6,6 +6,8 @@ ; CHECK: Unable to determine comdat of alias! +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @g1 = global i32 1 @g2 = global i32 2 diff --git a/test/tools/gold/X86/bcsection.ll b/test/tools/gold/X86/bcsection.ll index f7ebe375770..8d1598751d8 100644 --- a/test/tools/gold/X86/bcsection.ll +++ b/test/tools/gold/X86/bcsection.ll @@ -5,6 +5,7 @@ ; RUN: %gold -r -o %T/bcsection.o -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold.so %T/bcsection.bco ; RUN: llvm-nm -no-llvm-bc %T/bcsection.o | FileCheck %s +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-unknown" ; CHECK: main diff --git a/test/tools/gold/X86/cache.ll b/test/tools/gold/X86/cache.ll index 756710e482b..cef983c4a1a 100644 --- a/test/tools/gold/X86/cache.ll +++ b/test/tools/gold/X86/cache.ll @@ -24,6 +24,7 @@ ; RUN: ls %t.cache | count 2 +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define void @globalfunc() #0 { diff --git a/test/tools/gold/X86/coff.ll b/test/tools/gold/X86/coff.ll index 70d4f916159..541383ddf51 100644 --- a/test/tools/gold/X86/coff.ll +++ b/test/tools/gold/X86/coff.ll @@ -3,7 +3,7 @@ ; RUN: -shared %t.o -o %t2.o ; RUN: llvm-dis %t2.o -o - | FileCheck %s - +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "m:w" ; CHECK: define void @f() { diff --git a/test/tools/gold/X86/comdat.ll b/test/tools/gold/X86/comdat.ll index 2170bf89d0c..8ed520c17c0 100644 --- a/test/tools/gold/X86/comdat.ll +++ b/test/tools/gold/X86/comdat.ll @@ -5,6 +5,8 @@ ; RUN: FileCheck --check-prefix=RES %s < %t3.o.resolution.txt ; RUN: llvm-readobj -t %t3.o | FileCheck --check-prefix=OBJ %s +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + $c1 = comdat any @v1 = weak_odr global i32 42, comdat($c1) diff --git a/test/tools/gold/X86/comdat2.ll b/test/tools/gold/X86/comdat2.ll index 2156efd207b..a15ae1daf5a 100644 --- a/test/tools/gold/X86/comdat2.ll +++ b/test/tools/gold/X86/comdat2.ll @@ -5,6 +5,7 @@ ; RUN: -shared %t.bc %t2.bc -o %t3.bc ; RUN: llvm-dis %t3.bc -o - | FileCheck %s +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" $foo = comdat any @foo = global i8 0, comdat diff --git a/test/tools/gold/X86/common.ll b/test/tools/gold/X86/common.ll index 25a889f8fd6..ca506f6dd2d 100644 --- a/test/tools/gold/X86/common.ll +++ b/test/tools/gold/X86/common.ll @@ -3,6 +3,8 @@ ; RUN: llvm-as %p/Inputs/common2.ll -o %t2b.o ; RUN: llvm-as %p/Inputs/common3.ll -o %t2c.o +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @a = common global i16 0, align 8 ; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \ diff --git a/test/tools/gold/X86/ctors.ll b/test/tools/gold/X86/ctors.ll index 24c8e342beb..068a503a105 100644 --- a/test/tools/gold/X86/ctors.ll +++ b/test/tools/gold/X86/ctors.ll @@ -4,6 +4,8 @@ ; RUN: -shared %t.o -o %t2.o ; RUN: llvm-dis %t2.o -o - | FileCheck %s +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @foo, i8* null }] define internal void @foo() { diff --git a/test/tools/gold/X86/ctors2.ll b/test/tools/gold/X86/ctors2.ll index c39cb7132d9..07802c0a5c1 100644 --- a/test/tools/gold/X86/ctors2.ll +++ b/test/tools/gold/X86/ctors2.ll @@ -5,6 +5,8 @@ ; RUN: -shared %t.o %t2.o -o %t3.o ; RUN: llvm-dis %t3.o -o - | FileCheck %s +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @foo, i8* null }] define void @foo() { diff --git a/test/tools/gold/X86/disable-verify.ll b/test/tools/gold/X86/disable-verify.ll index af64061704b..6463504630f 100644 --- a/test/tools/gold/X86/disable-verify.ll +++ b/test/tools/gold/X86/disable-verify.ll @@ -10,6 +10,7 @@ ; RUN: --plugin-opt=-debug-pass=Arguments \ ; RUN: -shared %t.o -o %t2.o 2>&1 | FileCheck %s -check-prefix=VERIFY +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" ; -disable-verify should disable output verification from the optimization diff --git a/test/tools/gold/X86/drop-linkage.ll b/test/tools/gold/X86/drop-linkage.ll index 3013c247aa6..c85d28e15cc 100644 --- a/test/tools/gold/X86/drop-linkage.ll +++ b/test/tools/gold/X86/drop-linkage.ll @@ -7,6 +7,8 @@ ; RUN: -shared %t.o %t2.o -o %t3.o ; RUN: llvm-dis %t3.o -o - | FileCheck %s +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + define void @foo() { ret void } diff --git a/test/tools/gold/X86/emit-llvm.ll b/test/tools/gold/X86/emit-llvm.ll index ec1ea8f3673..70d244c34ec 100644 --- a/test/tools/gold/X86/emit-llvm.ll +++ b/test/tools/gold/X86/emit-llvm.ll @@ -22,6 +22,7 @@ ; NM: T f3 +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" ; CHECK-DAG: @g1 = weak_odr constant i32 32 diff --git a/test/tools/gold/X86/irmover-error.ll b/test/tools/gold/X86/irmover-error.ll index 2bfbaf4e8af..32f4b018bf6 100644 --- a/test/tools/gold/X86/irmover-error.ll +++ b/test/tools/gold/X86/irmover-error.ll @@ -4,6 +4,8 @@ ; CHECK: fatal error: Failed to link module {{.*}}2.bc: linking module flags 'foo': IDs have conflicting values +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + !0 = !{ i32 1, !"foo", i32 1 } !llvm.module.flags = !{ !0 } diff --git a/test/tools/gold/X86/linker-script.ll b/test/tools/gold/X86/linker-script.ll index 7c88b0ffd5f..3cc067550a6 100644 --- a/test/tools/gold/X86/linker-script.ll +++ b/test/tools/gold/X86/linker-script.ll @@ -6,6 +6,8 @@ ; RUN: -version-script=%p/Inputs/linker-script.export ; RUN: llvm-dis %t2.o -o - | FileCheck %s +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + ; CHECK: define void @f() define void @f() { ret void diff --git a/test/tools/gold/X86/linkonce-weak.ll b/test/tools/gold/X86/linkonce-weak.ll index fa6372cda81..258c8dc1fa7 100644 --- a/test/tools/gold/X86/linkonce-weak.ll +++ b/test/tools/gold/X86/linkonce-weak.ll @@ -11,6 +11,8 @@ ; RUN: -shared %t2.o %t.o -o %t3.o ; RUN: llvm-dis %t3.o -o - | FileCheck %s +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + define linkonce_odr void @f() !dbg !4 { ret void, !dbg !10 } diff --git a/test/tools/gold/X86/mixed_lto.ll b/test/tools/gold/X86/mixed_lto.ll index c7085940203..4b53ff9ec38 100644 --- a/test/tools/gold/X86/mixed_lto.ll +++ b/test/tools/gold/X86/mixed_lto.ll @@ -12,6 +12,7 @@ ; CHECK-DAG: T main ; CHECK-DAG: T g +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define i32 @g() { ret i32 0 diff --git a/test/tools/gold/X86/no-map-whole-file.ll b/test/tools/gold/X86/no-map-whole-file.ll index 4c261d70a24..eb74bd78fc9 100644 --- a/test/tools/gold/X86/no-map-whole-file.ll +++ b/test/tools/gold/X86/no-map-whole-file.ll @@ -4,6 +4,9 @@ ; RUN: llvm-dis < %t2.bc -o - | FileCheck %s ; CHECK: main + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + define i32 @main() { ret i32 0 } diff --git a/test/tools/gold/X86/opt-level.ll b/test/tools/gold/X86/opt-level.ll index 66935b478cf..d072866f7db 100644 --- a/test/tools/gold/X86/opt-level.ll +++ b/test/tools/gold/X86/opt-level.ll @@ -12,6 +12,9 @@ ; CHECK-O0: define internal void @foo( ; CHECK-O1: define internal void @foo( ; CHECK-O2-NOT: define internal void @foo( + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + define internal void @foo() { ret void } diff --git a/test/tools/gold/X86/parallel.ll b/test/tools/gold/X86/parallel.ll index e1923ae73f8..52232918c80 100644 --- a/test/tools/gold/X86/parallel.ll +++ b/test/tools/gold/X86/parallel.ll @@ -6,6 +6,7 @@ ; RUN: llvm-nm %t.o0 | FileCheck --check-prefix=CHECK0 %s ; RUN: llvm-nm %t.o1 | FileCheck --check-prefix=CHECK1 %s +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" ; CHECK-BC0: define void @foo diff --git a/test/tools/gold/X86/pr19901.ll b/test/tools/gold/X86/pr19901.ll index d1b1076b6ea..7967f6cc42a 100644 --- a/test/tools/gold/X86/pr19901.ll +++ b/test/tools/gold/X86/pr19901.ll @@ -15,6 +15,7 @@ ; CHECK: Section: .text ; CHECK-NEXT: } +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define i32 @g() { call void @f() diff --git a/test/tools/gold/X86/pr19901_thinlto.ll b/test/tools/gold/X86/pr19901_thinlto.ll index f2532902577..6a9dd2432fd 100644 --- a/test/tools/gold/X86/pr19901_thinlto.ll +++ b/test/tools/gold/X86/pr19901_thinlto.ll @@ -16,6 +16,7 @@ ; CHECK: Section: .text ; CHECK-NEXT: } +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define i32 @g() { call void @f() diff --git a/test/tools/gold/X86/pr25907.ll b/test/tools/gold/X86/pr25907.ll index 502938cf812..f33f2f24245 100644 --- a/test/tools/gold/X86/pr25907.ll +++ b/test/tools/gold/X86/pr25907.ll @@ -4,6 +4,8 @@ ; RUN: llvm-nm %t2 | FileCheck %s ; CHECK: T main +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @main.L = internal unnamed_addr constant [3 x i8*] [i8* blockaddress(@main, %L1), i8* blockaddress(@main, %L2), i8* null], align 16 define i32 @main() #0 { diff --git a/test/tools/gold/X86/pr25915.ll b/test/tools/gold/X86/pr25915.ll index e94283072b1..20e4b8b4882 100644 --- a/test/tools/gold/X86/pr25915.ll +++ b/test/tools/gold/X86/pr25915.ll @@ -5,6 +5,8 @@ ; RUN: llvm-dis %t2 -o - | FileCheck %s ; CHECK-NOT: subprograms +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!3, !4} !llvm.ident = !{!5} diff --git a/test/tools/gold/X86/relax-relocs.ll b/test/tools/gold/X86/relax-relocs.ll index 13a813fad08..72f081e81c3 100644 --- a/test/tools/gold/X86/relax-relocs.ll +++ b/test/tools/gold/X86/relax-relocs.ll @@ -7,6 +7,7 @@ ; Test that we produce R_X86_64_GOTPCREL instead of R_X86_64_GOTPCRELX ; CHECK: R_X86_64_GOTPCREL foo +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @foo = external global i32 diff --git a/test/tools/gold/X86/resolve-to-alias.ll b/test/tools/gold/X86/resolve-to-alias.ll index 102da6f80f4..bf4a33fcb33 100644 --- a/test/tools/gold/X86/resolve-to-alias.ll +++ b/test/tools/gold/X86/resolve-to-alias.ll @@ -15,6 +15,8 @@ ; RUN: FileCheck --check-prefix=PASS1 %s < %t.ll ; RUN: FileCheck --check-prefix=PASS2 %s < %t.ll +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + define void @foo() { call void @bar() ret void diff --git a/test/tools/gold/X86/slp-vectorize.ll b/test/tools/gold/X86/slp-vectorize.ll index e63a21cbb53..7ce4b8ecec7 100644 --- a/test/tools/gold/X86/slp-vectorize.ll +++ b/test/tools/gold/X86/slp-vectorize.ll @@ -8,6 +8,7 @@ ; test that the vectorizer is run. ; CHECK: fadd <4 x float> +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define void @f(float* nocapture %x) { diff --git a/test/tools/gold/X86/start-lib-common.ll b/test/tools/gold/X86/start-lib-common.ll index f4de62ec99b..085cfbd903f 100644 --- a/test/tools/gold/X86/start-lib-common.ll +++ b/test/tools/gold/X86/start-lib-common.ll @@ -9,6 +9,7 @@ ; RUN: -shared %t1.o --start-lib %t2.o --end-lib -o %t3.o ; RUN: llvm-dis %t3.o -o - | FileCheck %s +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" @x = common global i32 0, align 4 ; ToT gold (as of 03/2016) honors --start-lib/--end-lib, drops %t2.o and ends up diff --git a/test/tools/gold/X86/strip_names.ll b/test/tools/gold/X86/strip_names.ll index 2664a82fbd1..bb974c8aebe 100644 --- a/test/tools/gold/X86/strip_names.ll +++ b/test/tools/gold/X86/strip_names.ll @@ -24,6 +24,8 @@ ; NONAME: %3 = add i32 %0, %2 ; NONAME: ret i32 %3 +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + @GlobalValueName = global i32 0 define i32 @foo(i32 %in) { diff --git a/test/tools/gold/X86/thinlto.ll b/test/tools/gold/X86/thinlto.ll index adc52bd0e10..9ce070a6b5e 100644 --- a/test/tools/gold/X86/thinlto.ll +++ b/test/tools/gold/X86/thinlto.ll @@ -115,6 +115,8 @@ ; COMBINED-NEXT: