Mehdi Amini | e98f925 | 2016-12-28 22:30:28 +0000 | [diff] [blame] | 1 | ; RUN: llvm-as <%s -bitcode-mdindex-threshold=0 | llvm-bcanalyzer -dump | FileCheck %s -check-prefix=CHECK -check-prefix=MDINDEX |
| 2 | ; RUN: llvm-as <%s | llvm-bcanalyzer -dump | FileCheck %s -check-prefix=CHECK |
Duncan P. N. Exon Smith | 30805b2 | 2016-04-23 04:59:22 +0000 | [diff] [blame] | 3 | ; Check that distinct nodes are emitted in post-order to avoid unnecessary |
| 4 | ; forward references. |
| 5 | |
| 6 | ; Nodes in this testcase are numbered to match how they are referenced in |
| 7 | ; bitcode. !3 is referenced as opN=3. |
| 8 | |
| 9 | ; The leafs should come first (in either order). |
| 10 | ; CHECK: <DISTINCT_NODE/> |
| 11 | ; CHECK-NEXT: <DISTINCT_NODE/> |
| 12 | !1 = distinct !{} |
| 13 | !2 = distinct !{} |
| 14 | |
| 15 | ; CHECK-NEXT: <DISTINCT_NODE op0=1 op1=2/> |
| 16 | !3 = distinct !{!1, !2} |
| 17 | |
| 18 | ; CHECK-NEXT: <DISTINCT_NODE op0=1 op1=3 op2=2/> |
| 19 | !4 = distinct !{!1, !3, !2} |
| 20 | |
Mehdi Amini | e98f925 | 2016-12-28 22:30:28 +0000 | [diff] [blame] | 21 | ; Before the named records we emit the index containing the position of the |
| 22 | ; previously emitted records, but only if we have a number of record above |
| 23 | ; a threshold (can be controlled through `-bitcode-mdindex-threshold`). |
| 24 | ; MDINDEX: <INDEX {{.*}} (offset match) |
| 25 | |
Duncan P. N. Exon Smith | 30805b2 | 2016-04-23 04:59:22 +0000 | [diff] [blame] | 26 | ; Note: named metadata nodes are not cannot reference null so their operands |
| 27 | ; are numbered off-by-one. |
| 28 | ; CHECK-NEXT: <NAME |
| 29 | ; CHECK-NEXT: <NAMED_NODE op0=3/> |
| 30 | !named = !{!4} |