Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / runtime / X86 / hot-end-symbol.s
blobe6d83d77167acde60626e0be308fb3f3c716ca39
1 # This reproduces a bug where BOLT would read __hot_end as
2 # the name of a function even when -hot-text is used, which
3 # means BOLT will emit another __hot_end label, eventually
4 # asserting due to a symbol redefinition in MCStreamer.
6 # REQUIRES: system-linux
8 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
9 # RUN: %s -o %t.o
10 # RUN: link_fdata %s %t.o %t.fdata
11 # RUN: llvm-strip --strip-unneeded %t.o
12 # RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q
14 # RUN: llvm-bolt %t.exe --relocs=1 --hot-text --reorder-functions=hfsort \
15 # RUN: --data %t.fdata -o %t.out | FileCheck %s
17 # RUN: %t.out 1
19 # CHECK: BOLT-INFO: setting __hot_end to
21 # RUN: llvm-nm -n %t.exe | FileCheck %s --check-prefix=CHECK-INPUT
22 # RUN: llvm-nm -n %t.out | FileCheck %s --check-prefix=CHECK-OUTPUT
24 # CHECK-INPUT: __hot_start
25 # CHECK-INPUT-NEXT: main
26 # CHECK-INPUT-NEXT: foo
27 # CHECK-INPUT-NEXT: __hot_end
29 # Our fdata only logs activity in main, so hot markers will change
30 # CHECK-OUTPUT: __hot_start
31 # CHECK-OUTPUT-NEXT: main
32 # CHECK-OUTPUT-NEXT: __hot_end
34 .text
35 .globl main
36 .type main, %function
37 .globl __hot_start
38 .type __hot_start, %object
39 .p2align 4
40 main:
41 __hot_start:
42 # FDATA: 0 [unknown] 0 1 main 0 0 510
43 pushq %rbp
44 movq %rsp, %rbp
45 cmpl $0x2, %edi
46 jb .BBend
47 .BB2:
48 callq bar
49 leaq mystring, %rdi
50 callq puts
52 .BBend:
53 xorq %rax, %rax
54 leaveq
55 retq
56 .size main, .-main
58 .globl foo
59 .type foo, %function
60 .p2align 4
61 foo:
62 retq
63 .size foo, .-foo
65 .globl __hot_end
66 .type __hot_end, %object
67 .p2align 2
68 __hot_end:
69 int3
70 .size __hot_end, 0
72 .globl bar
73 .type bar, %function
74 .p2align 4
75 bar:
76 retq
77 .size bar, .-bar
79 .data
80 mystring: .asciz "test\n"