1; RUN: llvm-as <%s | llvm-bcanalyzer -dump | FileCheck %s 2; Check that distinct nodes are emitted in post-order to avoid unnecessary 3; forward references. 4 5; Nodes in this testcase are numbered to match how they are referenced in 6; bitcode. !3 is referenced as opN=3. 7 8; The leafs should come first (in either order). 9; CHECK: <DISTINCT_NODE/> 10; CHECK-NEXT: <DISTINCT_NODE/> 11!1 = distinct !{} 12!2 = distinct !{} 13 14; CHECK-NEXT: <DISTINCT_NODE op0=1 op1=2/> 15!3 = distinct !{!1, !2} 16 17; CHECK-NEXT: <DISTINCT_NODE op0=1 op1=3 op2=2/> 18!4 = distinct !{!1, !3, !2} 19 20; Note: named metadata nodes are not cannot reference null so their operands 21; are numbered off-by-one. 22; CHECK-NEXT: <NAME 23; CHECK-NEXT: <NAMED_NODE op0=3/> 24!named = !{!4} 25