summaryrefslogtreecommitdiffstats
path: root/llvm/test/Linker
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Linker')
-rw-r--r--llvm/test/Linker/Inputs/unique-fwd-decl-order.ll6
-rw-r--r--llvm/test/Linker/unique-fwd-decl-order.ll20
2 files changed, 26 insertions, 0 deletions
diff --git a/llvm/test/Linker/Inputs/unique-fwd-decl-order.ll b/llvm/test/Linker/Inputs/unique-fwd-decl-order.ll
new file mode 100644
index 00000000000..756e37903ca
--- /dev/null
+++ b/llvm/test/Linker/Inputs/unique-fwd-decl-order.ll
@@ -0,0 +1,6 @@
+!named = !{!0}
+
+; These nodes are intentionally in the opposite order from the test-driver.
+; However, they are numbered the same for the reader's convenience.
+!1 = metadata !{}
+!0 = metadata !{metadata !1}
diff --git a/llvm/test/Linker/unique-fwd-decl-order.ll b/llvm/test/Linker/unique-fwd-decl-order.ll
new file mode 100644
index 00000000000..d356cf36a3f
--- /dev/null
+++ b/llvm/test/Linker/unique-fwd-decl-order.ll
@@ -0,0 +1,20 @@
+; RUN: llvm-link %s %S/Inputs/unique-fwd-decl-order.ll -S -o - | FileCheck %s
+; RUN: llvm-link %S/Inputs/unique-fwd-decl-order.ll %s -S -o - | FileCheck %s
+
+; This test exercises MDNode hashing. For the nodes to be correctly uniqued,
+; the hash of a to-be-created MDNode has to match the hash of an
+; operand-just-changed MDNode (with the same operands).
+;
+; Note that these two assembly files number the nodes identically, even though
+; the nodes are in a different order. This is for the reader's convenience.
+
+; CHECK: !named = !{!0, !0}
+!named = !{!0}
+
+; CHECK: !0 = metadata !{metadata !1}
+!0 = metadata !{metadata !1}
+
+; CHECK: !1 = metadata !{}
+!1 = metadata !{}
+
+; CHECK-NOT: !2
OpenPOWER on IntegriCloud