[PATCH] D61857: [LTO] Improve readability of module IDs
Igor Kudrin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 13 09:08:35 PDT 2019
ikudrin created this revision.
ikudrin added reviewers: ruiu, davide, grimar.
Herald added subscribers: dexonsmith, steven_wu, MaskRay, arichardson, inglorion, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
Module IDs can appear in diagnostic messages.
This patch adds some auxiliary symbols to improve their readability.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D61857
Files:
ELF/InputFiles.cpp
test/ELF/lto/Inputs/irmover-warning.ll
test/ELF/lto/irmover-warning.ll
Index: test/ELF/lto/irmover-warning.ll
===================================================================
--- /dev/null
+++ test/ELF/lto/irmover-warning.ll
@@ -0,0 +1,21 @@
+; 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 ('i32 2' from {{.*}}irmover-warning.ll.tmp.a:{{[0-9]+}}(irmover-warning.ll.tmp2.bc) with 'i32 1' from ld-temp.o)
+
+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 }
Index: test/ELF/lto/Inputs/irmover-warning.ll
===================================================================
--- /dev/null
+++ test/ELF/lto/Inputs/irmover-warning.ll
@@ -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 }
Index: ELF/InputFiles.cpp
===================================================================
--- ELF/InputFiles.cpp
+++ ELF/InputFiles.cpp
@@ -1141,10 +1141,13 @@
// 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;
+ if (ArchiveName.empty())
+ Name = Saver.save(Path);
+ else
+ Name = Saver.save(ArchiveName + ":" + utostr(OffsetInArchive) +
+ "(" + Path + ")");
+ MemoryBufferRef MBRef(MB.getBuffer(), Name);
Obj = CHECK(lto::InputFile::create(MBRef), this);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61857.199270.patch
Type: text/x-patch
Size: 1993 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190513/f7d283b5/attachment.bin>
More information about the llvm-commits
mailing list