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 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 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 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} 31