1# REQUIRES: x86
2# This test checks that CallGraphSort ignores edges that would form "bad"
3# clusters.
4
5# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
6# RUN: echo "A C 1" > %t.call_graph
7# RUN: echo "E B 4" >> %t.call_graph
8# RUN: echo "C D 2" >> %t.call_graph
9# RUN: echo "B D 1" >> %t.call_graph
10# RUN: echo "F G 6" >> %t.call_graph
11# RUN: echo "G H 5" >> %t.call_graph
12# RUN: echo "H I 4" >> %t.call_graph
13# RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph -o %t2
14# RUN: llvm-readobj --symbols %t2 | FileCheck %s
15
16    .section    .text.A,"ax",@progbits
17    .globl A
18A:
19    retq
20
21    .section    .text.D,"ax",@progbits
22D:
23    .fill 1000, 1, 0
24
25    .section    .text.E,"ax",@progbits
26E:
27    retq
28
29    .section    .text.C,"ax",@progbits
30C:
31    retq
32
33    .section    .text.B,"ax",@progbits
34B:
35    .fill 1000, 1, 0
36
37    .section    .text.F,"ax",@progbits
38F:
39    .fill (1024 * 1024) - 1, 1, 0
40
41    .section    .text.G,"ax",@progbits
42G:
43    retq
44
45    .section    .text.H,"ax",@progbits
46H:
47    retq
48
49    .section    .text.I,"ax",@progbits
50I:
51    .fill 13, 1, 0
52
53# CHECK:          Name: B
54# CHECK-NEXT:     Value: 0x201131
55# CHECK:          Name: C
56# CHECK-NEXT:     Value: 0x20112F
57# CHECK:          Name: D
58# CHECK-NEXT:     Value: 0x201519
59# CHECK:          Name: E
60# CHECK-NEXT:     Value: 0x201130
61# CHECK:          Name: F
62# CHECK-NEXT:     Value: 0x201901
63# CHECK:          Name: G
64# CHECK-NEXT:     Value: 0x301900
65# CHECK:          Name: H
66# CHECK-NEXT:     Value: 0x201120
67# CHECK:          Name: I
68# CHECK-NEXT:     Value: 0x201121
69# CHECK:          Name: A
70# CHECK-NEXT:     Value: 0x20112E
71