Skip to content

Commit 9cd9eb3

Browse files
committed
Print conflicting operands between Src and Dest modules
1 parent 61057b0 commit 9cd9eb3

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

llvm/lib/Linker/IRMover.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,11 +1430,15 @@ Error IRLinker::linkModuleFlagsMetadata() {
14301430
llvm_unreachable("not possible");
14311431
case Module::Error: {
14321432
// Emit an error if the values differ.
1433-
if (SrcOp->getOperand(2) != DstOp->getOperand(2))
1434-
return stringErr("linking module flags '" + ID->getString() +
1435-
"': IDs have conflicting values in '" +
1436-
SrcM->getModuleIdentifier() + "' and '" +
1437-
DstM.getModuleIdentifier() + "'");
1433+
if (SrcOp->getOperand(2) != DstOp->getOperand(2)) {
1434+
std::string Str;
1435+
raw_string_ostream(Str)
1436+
<< "linking module flags '" << ID->getString()
1437+
<< "': IDs have conflicting values: '" << *SrcOp->getOperand(2)
1438+
<< "' from " << SrcM->getModuleIdentifier() << ", and '"
1439+
<< *DstOp->getOperand(2) << "' from " + DstM.getModuleIdentifier();
1440+
return stringErr(Str);
1441+
}
14381442
continue;
14391443
}
14401444
case Module::Warning: {

llvm/test/LTO/X86/codemodel-3.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ entry:
1818
ret ptr @data
1919
}
2020

21-
; CHECK: 'Code Model': IDs have conflicting values
21+
; CHECK: 'Code Model': IDs have conflicting values: 'i32 1' from {{.*}}, and 'i32 4' from {{.*}}

llvm/test/LTO/X86/largedatathreshold-3.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
; RUN: not llvm-lto2 run -r %t0.o,_start,px -r %t1.o,bar,px -r %t0.o,_GLOBAL_OFFSET_TABLE_, \
44
; RUN: -r %t1.o,_GLOBAL_OFFSET_TABLE_, %t0.o %t1.o -o %t2.s 2>&1 | FileCheck %s
55

6-
; CHECK: 'Large Data Threshold': IDs have conflicting values
6+
; CHECK: 'Large Data Threshold': IDs have conflicting value s
7+
; CHECK: 'Large Data Threshold': IDs have conflicting values: 'i32 101' from {{.*}}, and 'i32 100' from {{.*}}
78

89
target triple = "x86_64-unknown-linux-gnu"
910
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

llvm/test/Linker/module-flags-6-a.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
; Test module flags error messages.
44

5-
; CHECK: linking module flags 'foo': IDs have conflicting values in '{{.*}}module-flags-6-b.ll' and 'llvm-link'
5+
; CHECK: linking module flags 'foo': IDs have conflicting values: 'i32 38' from {{.*}}module-flags-6-b.ll, and 'i32 37' from llvm-link
66

77
!0 = !{ i32 1, !"foo", i32 37 }
88

llvm/test/Transforms/FunctionImport/module-flags.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
; RUN: llvm-lto -thinlto -o 3 1.bc 2.bc
55
; RUN: opt -S -passes=function-import -summary-file 3.thinlto.bc 1.bc 2>&1 | FileCheck %s
66

7-
; CHECK: Function Import: link error: linking module flags 'Error': IDs have conflicting values in '2.bc' and '1.bc'
7+
; CHECK: Function Import: link error: linking module flags 'Error': IDs have conflicting values: 'i32 1' from 2.bc, and 'i32 0' from 1.bc
88

99
;--- 1.ll
1010
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

0 commit comments

Comments
 (0)