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