Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / clang-sections-1.cpp
blob8e1361e4060a723506f8e6b0140994e73e049c17
1 // RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -o - %s | FileCheck %s --check-prefix=LLVM
2 // RUN: %clang_cc1 -triple x86_64-linux -S -o - %s | FileCheck %s --check-prefix=ASM
3 // Actually, any ELF target would do
4 // REQUIRES: x86-registered-target
6 #pragma clang section bss = "B$$" data = "d@t@" rodata = "r0d@t@"
8 const int a = 1;
9 const int *f() { return &a; }
11 int init();
12 const int b = init();
14 int c = 2;
16 int d = init();
18 int e;
20 // LLVM: @_ZL1a = internal constant i32 1, align 4 #[[#A:]]
21 // LLVM: @_ZL1b = internal global i32 0, align 4 #[[#A]]
22 // LLVM: @c = {{.*}}global i32 2, align 4 #[[#A]]
23 // LLVM: @d = {{.*}}global i32 0, align 4 #[[#A]]
24 // LLVM: @e = {{.*}}global i32 0, align 4 #[[#A]]
26 // LLVM: attributes #[[#A]] = { "bss-section"="B$$" "data-section"="d@t@" "rodata-section"="r0d@t@" }
28 // ASM: .section "r0d@t@","a",@progbits
29 // ASM-NOT: .section
30 // ASM-LABEL: _ZL1a:
31 // ASM-NEXT: .long 1
33 // ASM: .section "B$$","aw",@nobits
34 // ASM-NOT: .section
35 // ASM-LABEL: _ZL1b:
36 // ASM-NEXT: .long 0
38 // ASM: .section "d@t@","aw",@progbits
39 // ASM-NOT: .section
40 // ASM-LABEL: c:
41 // ASM: .long 2
43 // ASM: .section "B$$","aw",@nobits
44 // ASM-NOT: .section
45 // ASM-LABEL: d:
46 // ASM: .long 0
48 // ASM-NOT: .section
49 // ASM-LABEL: e:
50 // ASM .long 0