[lld] r360858 - [LTO] Improve readability of module IDs
Igor Kudrin via llvm-commits
llvm-commits at lists.llvm.org
Wed May 15 22:23:25 PDT 2019
Author: ikudrin
Date: Wed May 15 22:23:25 2019
New Revision: 360858
URL: http://llvm.org/viewvc/llvm-project?rev=360858&view=rev
Log:
[LTO] Improve readability of module IDs
Module IDs can appear in diagnostic messages.
This patch adds some auxiliary symbols to improve their readability.
Differential Revision: https://reviews.llvm.org/D61857
Added:
lld/trunk/test/ELF/lto/Inputs/irmover-warning.ll
lld/trunk/test/ELF/lto/irmover-warning.ll
Modified:
lld/trunk/ELF/InputFiles.cpp
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=360858&r1=360857&r2=360858&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Wed May 15 22:23:25 2019
@@ -1241,10 +1241,11 @@ BitcodeFile::BitcodeFile(MemoryBufferRef
// into consideration at LTO time (which very likely causes undefined
// symbols later in the link stage). So we append file offset to make
// filename unique.
- MemoryBufferRef MBRef(
- MB.getBuffer(),
- Saver.save(ArchiveName + Path +
- (ArchiveName.empty() ? "" : utostr(OffsetInArchive))));
+ StringRef Name = ArchiveName.empty()
+ ? Saver.save(Path)
+ : Saver.save(ArchiveName + "(" + Path + " at " +
+ utostr(OffsetInArchive) + ")");
+ MemoryBufferRef MBRef(MB.getBuffer(), Name);
Obj = CHECK(lto::InputFile::create(MBRef), this);
Added: lld/trunk/test/ELF/lto/Inputs/irmover-warning.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/Inputs/irmover-warning.ll?rev=360858&view=auto
==============================================================================
--- lld/trunk/test/ELF/lto/Inputs/irmover-warning.ll (added)
+++ lld/trunk/test/ELF/lto/Inputs/irmover-warning.ll Wed May 15 22:23:25 2019
@@ -0,0 +1,10 @@
+target triple = "x86_64-unknown-linux-gnu"
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+define void @f() {
+ ret void
+}
+
+!0 = !{ i32 2, !"foo", i32 2 }
+
+!llvm.module.flags = !{ !0 }
Added: lld/trunk/test/ELF/lto/irmover-warning.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/irmover-warning.ll?rev=360858&view=auto
==============================================================================
--- lld/trunk/test/ELF/lto/irmover-warning.ll (added)
+++ lld/trunk/test/ELF/lto/irmover-warning.ll Wed May 15 22:23:25 2019
@@ -0,0 +1,22 @@
+; RUN: llvm-as -o %t1.bc %s
+; RUN: llvm-as -o %t2.bc %S/Inputs/irmover-warning.ll
+; RUN: rm -f %t.a
+; RUN: llvm-ar rcs %t.a %t2.bc
+; RUN: ld.lld %t1.bc %t.a -o %t 2>&1 | FileCheck %s
+
+; CHECK: warning: linking module flags 'foo': IDs have conflicting values
+; CHECK-SAME: irmover-warning.ll.tmp.a(irmover-warning.ll.tmp2.bc at {{[0-9]+}})
+
+target triple = "x86_64-unknown-linux-gnu"
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+declare void @f()
+
+define void @g() {
+ call void @f()
+ ret void
+}
+
+!0 = !{ i32 2, !"foo", i32 1 }
+
+!llvm.module.flags = !{ !0 }
More information about the llvm-commits
mailing list