Skip to content

Commit d3eba09

Browse files
committed
[LTO] Print conflicting operands between Src and Dest modules
1 parent fd2e400 commit d3eba09

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

llvm/lib/Linker/IRMover.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,11 +1445,15 @@ Error IRLinker::linkModuleFlagsMetadata() {
14451445
llvm_unreachable("not possible");
14461446
case Module::Error: {
14471447
// Emit an error if the values differ.
1448-
if (SrcOp->getOperand(2) != DstOp->getOperand(2))
1449-
return stringErr("linking module flags '" + ID->getString() +
1450-
"': IDs have conflicting values in '" +
1451-
SrcM->getModuleIdentifier() + "' and '" +
1452-
DstM.getModuleIdentifier() + "'");
1448+
if (SrcOp->getOperand(2) != DstOp->getOperand(2)) {
1449+
std::string Str;
1450+
raw_string_ostream(Str)
1451+
<< "linking module flags '" << ID->getString()
1452+
<< "': IDs have conflicting values: '" << *SrcOp->getOperand(2)
1453+
<< "' from " << SrcM->getModuleIdentifier() << ", and '"
1454+
<< *DstOp->getOperand(2) << "' from " + DstM.getModuleIdentifier();
1455+
return stringErr(Str);
1456+
}
14531457
continue;
14541458
}
14551459
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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 values: 'i32 101' from {{.*}}, and 'i32 100' from {{.*}}
77

88
target triple = "x86_64-unknown-linux-gnu"
99
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)