summaryrefslogtreecommitdiffstats
path: root/llvm/test/Bitcode
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-08-28 20:26:49 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-08-28 20:26:49 +0000
commit814b8e91c74e9855e6962471b059327525604b1d (patch)
treeaf3aaeed4c28ff41c935e2608d50a7f47033588e /llvm/test/Bitcode
parent3a63f3fb22732d4ef38b2ef8f03c92736febb941 (diff)
downloadbcm5719-llvm-814b8e91c74e9855e6962471b059327525604b1d.tar.gz
bcm5719-llvm-814b8e91c74e9855e6962471b059327525604b1d.zip
DI: Require subprogram definitions to be distinct
As a follow-up to r246098, require `DISubprogram` definitions (`isDefinition: true`) to be 'distinct'. Specifically, add an assembler check, a verifier check, and bitcode upgrading logic to combat testcase bitrot after the `DIBuilder` change. While working on the testcases, I realized that test/Linker/subprogram-linkonce-weak-odr.ll isn't relevant anymore. Its purpose was to check for a corner case in PR22792 where two subprogram definitions match exactly and share the same metadata node. The new verifier check, requiring that subprogram definitions are 'distinct', precludes that possibility. I updated almost all the IR with the following script: git grep -l -E -e '= !DISubprogram\(.* isDefinition: true' | grep -v test/Bitcode | xargs sed -i '' -e 's/= \(!DISubprogram(.*, isDefinition: true\)/= distinct \1/' Likely some variant of would work for out-of-tree testcases. llvm-svn: 246327
Diffstat (limited to 'llvm/test/Bitcode')
-rw-r--r--llvm/test/Bitcode/DILocalVariable-explicit-tags.ll4
-rw-r--r--llvm/test/Bitcode/DISubprogram-distinct-definitions.ll11
-rw-r--r--llvm/test/Bitcode/DISubprogram-distinct-definitions.ll.bcbin0 -> 512 bytes
-rw-r--r--llvm/test/Bitcode/debug-loc-again.ll2
4 files changed, 14 insertions, 3 deletions
diff --git a/llvm/test/Bitcode/DILocalVariable-explicit-tags.ll b/llvm/test/Bitcode/DILocalVariable-explicit-tags.ll
index bca0a4c7bb0..3f7be3c061a 100644
--- a/llvm/test/Bitcode/DILocalVariable-explicit-tags.ll
+++ b/llvm/test/Bitcode/DILocalVariable-explicit-tags.ll
@@ -3,14 +3,14 @@
;
; RUN: llvm-dis < %s.bc -o - | llvm-as | llvm-dis | FileCheck %s
-; CHECK: ![[SP:[0-9]+]] = !DISubprogram(name: "foo",{{.*}} variables: ![[VARS:[0-9]+]]
+; CHECK: ![[SP:[0-9]+]] = distinct !DISubprogram(name: "foo",{{.*}} variables: ![[VARS:[0-9]+]]
; CHECK: ![[VARS]] = !{![[PARAM:[0-9]+]], ![[AUTO:[0-9]+]]}
; CHECK: ![[PARAM]] = !DILocalVariable(name: "param", arg: 1, scope: ![[SP]])
; CHECK: ![[AUTO]] = !DILocalVariable(name: "auto", scope: ![[SP]])
!named = !{!0}
-!0 = !DISubprogram(name: "foo", variables: !1)
+!0 = distinct !DISubprogram(name: "foo", variables: !1)
!1 = !{!2, !3}
!2 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "param", arg: 1, scope: !0)
!3 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "auto", scope: !0)
diff --git a/llvm/test/Bitcode/DISubprogram-distinct-definitions.ll b/llvm/test/Bitcode/DISubprogram-distinct-definitions.ll
new file mode 100644
index 00000000000..5c6fb908be9
--- /dev/null
+++ b/llvm/test/Bitcode/DISubprogram-distinct-definitions.ll
@@ -0,0 +1,11 @@
+; RUN: llvm-dis < %s.bc | FileCheck %s
+; Check that subprogram definitions are correctly upgraded to 'distinct'.
+; Bitcode compiled from r245235 of the 3.7 release branch.
+
+!named = !{!0}
+!0 = distinct !DICompileUnit(language: 12, file: !1, subprograms: !2)
+!1 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
+!2 = !{!3}
+
+; CHECK: = distinct !DISubprogram({{.*}}, isDefinition: true
+!3 = !DISubprogram(name: "foo", isDefinition: true)
diff --git a/llvm/test/Bitcode/DISubprogram-distinct-definitions.ll.bc b/llvm/test/Bitcode/DISubprogram-distinct-definitions.ll.bc
new file mode 100644
index 00000000000..600f68facc3
--- /dev/null
+++ b/llvm/test/Bitcode/DISubprogram-distinct-definitions.ll.bc
Binary files differ
diff --git a/llvm/test/Bitcode/debug-loc-again.ll b/llvm/test/Bitcode/debug-loc-again.ll
index a3923c85f88..adf74a07ebe 100644
--- a/llvm/test/Bitcode/debug-loc-again.ll
+++ b/llvm/test/Bitcode/debug-loc-again.ll
@@ -31,6 +31,6 @@ entry:
!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !DIFile(filename: "f", directory: "/d"),
subprograms: !{!2})
-!2 = !DISubprogram(name: "foo")
+!2 = distinct !DISubprogram(name: "foo")
!3 = !DILocation(line: 1, scope: !2)
!4 = !DILocation(line: 2, scope: !2)
OpenPOWER on IntegriCloud