[lld] r287699 - [LTO] Remove a check on datalayout.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 12:37:37 PST 2016


Author: davide
Date: Tue Nov 22 14:37:37 2016
New Revision: 287699

URL: http://llvm.org/viewvc/llvm-project?rev=287699&view=rev
Log:
[LTO] Remove a check on datalayout.

Now that lld switched to lib/LTO, which always calls setDataLayout(),
we don't need this check anymore.
Thanks to Peter for pointing out!

Added:
    lld/trunk/test/ELF/lto/bitcode-nodatalayout.ll
Removed:
    lld/trunk/test/ELF/lto/invalid-bitcode.ll
Modified:
    lld/trunk/ELF/LTO.cpp

Modified: lld/trunk/ELF/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=287699&r1=287698&r2=287699&view=diff
==============================================================================
--- lld/trunk/ELF/LTO.cpp (original)
+++ lld/trunk/ELF/LTO.cpp Tue Nov 22 14:37:37 2016
@@ -103,9 +103,6 @@ static void undefine(Symbol *S) {
 
 void BitcodeCompiler::add(BitcodeFile &F) {
   lto::InputFile &Obj = *F.Obj;
-  if (Obj.getDataLayoutStr().empty())
-    fatal("invalid bitcode file: " + F.getName() + " has no datalayout");
-
   unsigned SymNum = 0;
   std::vector<Symbol *> Syms = F.getSymbols();
   std::vector<lto::SymbolResolution> Resols(Syms.size());

Added: lld/trunk/test/ELF/lto/bitcode-nodatalayout.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/bitcode-nodatalayout.ll?rev=287699&view=auto
==============================================================================
--- lld/trunk/test/ELF/lto/bitcode-nodatalayout.ll (added)
+++ lld/trunk/test/ELF/lto/bitcode-nodatalayout.ll Tue Nov 22 14:37:37 2016
@@ -0,0 +1,15 @@
+; REQUIRES: x86
+; RUN: llvm-as %s -o %t.o
+; RUN: ld.lld -m elf_x86_64 %t.o -o %t
+; RUN: llvm-objdump -d %t | FileCheck %s
+
+; CHECK: _start:
+; CHECK-NEXT: retq
+
+; This bitcode file has no datalayout.
+; Check that we produce a valid binary out of it.
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @_start() {
+  ret void
+}

Removed: lld/trunk/test/ELF/lto/invalid-bitcode.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/invalid-bitcode.ll?rev=287698&view=auto
==============================================================================
--- lld/trunk/test/ELF/lto/invalid-bitcode.ll (original)
+++ lld/trunk/test/ELF/lto/invalid-bitcode.ll (removed)
@@ -1,12 +0,0 @@
-; REQUIRES: x86
-; RUN: llvm-as %s -o %t.o
-; RUN: not ld.lld -m elf_x86_64 %t.o 2>&1 | FileCheck %s
-
-; CHECK: invalid bitcode file:
-
-; This bitcode file has no datalayout.
-target triple = "x86_64-unknown-linux-gnu"
-
-define void @_start() {
-  ret void
-}




More information about the llvm-commits mailing list