Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / X86 / zero-sized-object.s
blob1f3522bce213c44af4bc9dd51ca01fe030e0c792
1 # Check that references to local (unnamed) objects below are not
2 # treated as references relative to zero-sized A object.
4 # REQUIRES: system-linux
6 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
7 # RUN: %s -o %t.o
8 # RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q
10 # RUN: llvm-bolt %t.exe --print-cfg \
11 # RUN: --print-only=main -o %t.out | FileCheck %s
13 .file "rust_bug.c"
14 .section .rodata
15 .LC0:
16 .string "0"
17 .LC1:
18 .string "1"
19 .LC2:
20 .string "2"
21 .LC3:
22 .string "3"
23 .LC4:
24 .string "4"
25 .LC5:
26 .string "5"
27 .text
28 .globl inc_dup
29 .type inc_dup, @function
30 inc_dup:
31 .LFB0:
32 .cfi_startproc
33 pushq %rbp
34 .cfi_def_cfa_offset 16
35 .cfi_offset 6, -16
36 movq %rsp, %rbp
37 .cfi_def_cfa_register 6
38 subq $16, %rsp
39 movl %edi, -4(%rbp)
40 movl -4(%rbp), %eax
41 subl $10, %eax
42 cmpl $5, %eax
43 ja .L2
44 movl %eax, %eax
45 movq .L4(,%rax,8), %rax
46 jmp *%rax
47 .section .rodata
48 .align 8
49 .globl A
50 .type A, @object
52 .section .rodata
53 .align 8
54 .align 4
55 .L4:
56 .quad .L3
57 .quad .L5
58 .quad .L6
59 .quad .L7
60 .quad .L8
61 .quad .L9
62 .text
63 .L3:
64 movl $.LC0, %edi
65 call puts
66 movl $1, %eax
67 jmp .L10
68 .L5:
69 movl $.LC1, %edi
70 call puts
71 movl $2, %eax
72 jmp .L10
73 .L6:
74 movl $.LC2, %edi
75 call puts
76 movl $3, %eax
77 jmp .L10
78 .L7:
79 movl $.LC3, %edi
80 call puts
81 movl $4, %eax
82 jmp .L10
83 .L8:
84 movl $.LC4, %edi
85 call puts
86 movl $5, %eax
87 jmp .L10
88 .L9:
89 movl $.LC5, %edi
90 call puts
91 movl $6, %eax
92 jmp .L10
93 .L2:
94 movl -4(%rbp), %eax
95 addl $1, %eax
96 .L10:
97 leave
98 .cfi_def_cfa 7, 8
99 ret
100 .cfi_endproc
101 .LFE0:
102 .size inc_dup, .-inc_dup
103 .section .rodata
104 .LC6:
105 .string "%d\n"
106 .text
107 .globl main
108 .type main, @function
109 main:
110 # CHECK: Binary Function "main" after building cfg
111 .LFB1:
112 .cfi_startproc
113 pushq %rbp
114 .cfi_def_cfa_offset 16
115 .cfi_offset 6, -16
116 movq %rsp, %rbp
117 .cfi_def_cfa_register 6
118 movl .LN(%rip), %eax
119 # We should not reference a data object as an offset from A
120 # CHECK-NOT: movl A+{{.*}}(%rip), %eax
121 movl %eax, %esi
122 movl $.LC6, %edi
123 movl $0, %eax
124 call printf
125 movl $0, %eax
126 popq %rbp
127 .cfi_def_cfa 7, 8
129 .cfi_endproc
130 .LFE1:
131 .size main, .-main
132 .section .rodata
133 .align 4
134 .LN:
135 .long 42
136 .ident "GCC: (GNU) 4.8.5 20150623 (Red Hat 4.8.5-44)"
137 .section .note.GNU-stack,"",@progbits