summaryrefslogtreecommitdiff
path: root/llvm/lib/Linker/IRMover.cpp
diff options
context:
space:
mode:
authorAdityaK <hiraditya@msn.com>2024-11-21 10:07:39 -0800
committerGitHub <noreply@github.com>2024-11-21 10:07:39 -0800
commit391bf068f2c124e98e18bbc027f4cfc6f0b413d6 (patch)
tree819d8f3c9ea4768219c37a7d763c3e2db8768167 /llvm/lib/Linker/IRMover.cpp
parentb22c3c1e88ad5be4ef9ee70ac6517620e1441336 (diff)
[LTO] Print conflicting operands between Src and Dest modules (#115104)
The current error message doesn't give sufficient details to help with debugging. This patch will log the operand values that are conflicting. After this patch the output is of the form: ``` 'Large Data Threshold': IDs have conflicting values: 'i32 101' from /usr/local/home/llvm-project/build/test/LTO/X86/Output/largedatathreshold-3.ll.tmp1.o, and 'i32 100' from ld-temp.o ```
Diffstat (limited to 'llvm/lib/Linker/IRMover.cpp')
-rw-r--r--llvm/lib/Linker/IRMover.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index 4bb0ddf89174..a0c3f2c5b0ba 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -1430,11 +1430,15 @@ Error IRLinker::linkModuleFlagsMetadata() {
llvm_unreachable("not possible");
case Module::Error: {
// Emit an error if the values differ.
- if (SrcOp->getOperand(2) != DstOp->getOperand(2))
- return stringErr("linking module flags '" + ID->getString() +
- "': IDs have conflicting values in '" +
- SrcM->getModuleIdentifier() + "' and '" +
- DstM.getModuleIdentifier() + "'");
+ if (SrcOp->getOperand(2) != DstOp->getOperand(2)) {
+ std::string Str;
+ raw_string_ostream(Str)
+ << "linking module flags '" << ID->getString()
+ << "': IDs have conflicting values: '" << *SrcOp->getOperand(2)
+ << "' from " << SrcM->getModuleIdentifier() << ", and '"
+ << *DstOp->getOperand(2) << "' from " + DstM.getModuleIdentifier();
+ return stringErr(Str);
+ }
continue;
}
case Module::Warning: {