summaryrefslogtreecommitdiffstats
path: root/llvm/test/Linker
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-19 18:00:19 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-19 18:00:19 +0000
commit9738602869dda75509a0f3782cd6639f9e3927c4 (patch)
tree7930467116f656492380f6cef7c78a9f8aa3f1b7 /llvm/test/Linker
parent40a34c2e2af8eaabfac246c9801af09a4e478dc1 (diff)
downloadbcm5719-llvm-9738602869dda75509a0f3782cd6639f9e3927c4.tar.gz
bcm5719-llvm-9738602869dda75509a0f3782cd6639f9e3927c4.zip
IR: Enable debug info type ODR uniquing for forward decls
Add a new method, DICompositeType::buildODRType, that will create or mutate the DICompositeType for a given ODR identifier, and use it in LLParser and BitcodeReader instead of DICompositeType::getODRType. The logic is as follows: - If there's no node, create one with the given arguments. - Else, if the current node is a forward declaration and the new arguments would create a definition, mutate the node to match the new arguments. - Else, return the old node. This adds a missing feature supported by the current DITypeIdentifierMap (which I'm slowly making redudant). The only remaining difference is that the DITypeIdentifierMap has a "the-last-one-wins" rule, whereas DICompositeType::buildODRType has a "the-first-one-wins" rule. For now I'm leaving behind DICompositeType::getODRType since it has obvious, low-level semantics that are convenient for unit testing. llvm-svn: 266786
Diffstat (limited to 'llvm/test/Linker')
-rw-r--r--llvm/test/Linker/Inputs/dicompositetype-unique.ll4
-rw-r--r--llvm/test/Linker/dicompositetype-unique.ll31
2 files changed, 31 insertions, 4 deletions
diff --git a/llvm/test/Linker/Inputs/dicompositetype-unique.ll b/llvm/test/Linker/Inputs/dicompositetype-unique.ll
index c2389e9a63c..e1537b93dfe 100644
--- a/llvm/test/Linker/Inputs/dicompositetype-unique.ll
+++ b/llvm/test/Linker/Inputs/dicompositetype-unique.ll
@@ -1,4 +1,6 @@
-!named = !{!0, !1}
+!named = !{!0, !1, !2, !3}
!0 = !DIFile(filename: "abc", directory: "/path/to")
!1 = !DICompositeType(tag: DW_TAG_class_type, name: "T2", identifier: "T", file: !0)
+!2 = !DICompositeType(tag: DW_TAG_class_type, name: "FwdTDef", identifier: "FwdT", file: !0)
+!3 = !DICompositeType(tag: DW_TAG_class_type, flags: DIFlagFwdDecl, name: "BothFwdT2", identifier: "BothFwdT", file: !0)
diff --git a/llvm/test/Linker/dicompositetype-unique.ll b/llvm/test/Linker/dicompositetype-unique.ll
index 6e4e34bdc2a..ab1fdaa3616 100644
--- a/llvm/test/Linker/dicompositetype-unique.ll
+++ b/llvm/test/Linker/dicompositetype-unique.ll
@@ -17,9 +17,9 @@
; Check that the type map will unique two DICompositeTypes.
-; CHECK: !named = !{!0, !1, !0, !1}
-; NOMAP: !named = !{!0, !1, !0, !2}
-!named = !{!0, !1}
+; CHECK: !named = !{!0, !1, !2, !3, !0, !1, !2, !3}
+; NOMAP: !named = !{!0, !1, !2, !3, !0, !4, !5, !6}
+!named = !{!0, !1, !2, !3}
; Check both directions.
; CHECK: !1 = distinct !DICompositeType(
@@ -27,14 +27,39 @@
; REVERSE-SAME: name: "T2"
; CHECK-SAME: identifier: "T"
; CHECK-NOT: identifier: "T"
+; CHECK: !2 = distinct !DICompositeType(
+; CHECK-SAME: name: "FwdTDef"
+; CHECK-SAME: identifier: "FwdT"
+; CHECK-NOT: identifier: "FwdT"
+; CHECK: !3 = distinct !DICompositeType(
+; FORWARD-SAME: name: "BothFwdT1"
+; REVERSE-SAME: name: "BothFwdT2"
+; CHECK-SAME: identifier: "BothFwdT"
+; CHECK-NOT: identifier: "BothFwdT"
; These types are different, so we should get both copies when there is no map.
; NOMAP: !1 = !DICompositeType(
; NOMAP-SAME: name: "T1"
; NOMAP-SAME: identifier: "T"
; NOMAP: !2 = !DICompositeType(
+; NOMAP-SAME: name: "FwdTFwd"
+; NOMAP-SAME: identifier: "FwdT"
+; NOMAP: !3 = !DICompositeType(
+; NOMAP-SAME: name: "BothFwdT1"
+; NOMAP-SAME: identifier: "BothFwdT"
+; NOMAP: !4 = !DICompositeType(
; NOMAP-SAME: name: "T2"
; NOMAP-SAME: identifier: "T"
; NOMAP-NOT: identifier: "T"
+; NOMAP: !5 = !DICompositeType(
+; NOMAP-SAME: name: "FwdTDef"
+; NOMAP-SAME: identifier: "FwdT"
+; NOMAP-NOT: identifier: "FwdT"
+; NOMAP: !6 = !DICompositeType(
+; NOMAP-SAME: name: "BothFwdT2"
+; NOMAP-SAME: identifier: "BothFwdT"
+; NOMAP-NOT: identifier: "BothFwdT"
!0 = !DIFile(filename: "abc", directory: "/path/to")
!1 = !DICompositeType(tag: DW_TAG_class_type, name: "T1", identifier: "T", file: !0)
+!2 = !DICompositeType(tag: DW_TAG_class_type, flags: DIFlagFwdDecl, name: "FwdTFwd", identifier: "FwdT", file: !0)
+!3 = !DICompositeType(tag: DW_TAG_class_type, flags: DIFlagFwdDecl, name: "BothFwdT1", identifier: "BothFwdT", file: !0)
OpenPOWER on IntegriCloud