Skip to content

Commit 2384a6a

Browse files
committed
Remove IRLinker::linkNamedMDNodes() assert
It was added in #157045, but will fail if there are duplicated nodes in DstM already, as illustrated by the test. See comments on the PR.
1 parent eeb4380 commit 2384a6a

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

llvm/lib/Linker/IRMover.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,6 @@ void IRLinker::linkNamedMDNodes() {
11521152
if (Inserted.insert(MD).second)
11531153
DestNMD->addOperand(MD);
11541154
}
1155-
assert(Inserted.size() == DestNMD->getNumOperands());
11561155
}
11571156
}
11581157

llvm/test/ThinLTO/X86/Inputs/import-metadata.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ entry:
1515
!llvm.module.flags = !{!2, !3}
1616
!llvm.md = !{!5}
1717

18+
; IRLinker shouldn't assert about duplicated operands.
19+
!llvm.ident = !{!6, !6}
20+
1821
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, enums: !4)
1922
!1 = !DIFile(filename: "foo.cpp", directory: "tmp")
2023
!2 = !{i32 2, !"Dwarf Version", i32 4}
2124
!3 = !{i32 2, !"Debug Info Version", i32 3}
2225
!4 = !{}
2326
!5 = !{!4}
27+
!6 = !{!"foo"}

llvm/test/ThinLTO/X86/import-metadata.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ define i32 @main() {
3333
!llvm.module.flags = !{!2, !3}
3434
!llvm.md = !{!5}
3535

36+
; IRLinker shouldn't assert about duplicated operands.
37+
!llvm.ident = !{!6, !6}
38+
3639
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, enums: !4)
3740
!1 = !DIFile(filename: "main.cpp", directory: "tmp")
3841
!2 = !{i32 2, !"Dwarf Version", i32 4}
3942
!3 = !{i32 2, !"Debug Info Version", i32 3}
4043
!4 = !{}
4144
!5 = !{!4}
45+
!6 = !{!"foo"}

0 commit comments

Comments
 (0)