1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/CodeGen/X86/undef-globals-bss.ll
Eli Friedman a8bbefe904 Place undefined globals in .bss instead of .data
Following up on the discussion from
http://lists.llvm.org/pipermail/llvm-dev/2017-April/112305.html, undef
values are now placed in the .bss as well as null values. This prevents
undef global values taking up potentially huge amounts of space in the
.data section.

The following two lines now both generate equivalent .bss data:

@vals1 = internal unnamed_addr global [20000000 x i32] zeroinitializer, align 4
@vals2 = internal unnamed_addr global [20000000 x i32] undef, align 4 ; previously unaccounted for

This is primarily motivated by the corresponding issue in the Rust
compiler (https://github.com/rust-lang/rust/issues/41315).

Differential Revision: https://reviews.llvm.org/D41705

Patch by varkor!

llvm-svn: 324424
2018-02-06 23:22:14 +00:00

13 lines
593 B
LLVM

; RUN: llc < %s | FileCheck %s
target triple = "x86_64-apple-darwin"
; CHECK: .zerofill __DATA,__bss,_vals,8000000,2 ## @vals
@vals = internal unnamed_addr global [2000000 x i32] undef, align 4
; CHECK: .zerofill __DATA,__bss,_struct,8000040,3 ## @struct
@struct = internal global { i1, [8000000 x i8], [7 x i8], i64, { [4 x i32], { i8 }, i1 } }
{ i1 false, [8000000 x i8] zeroinitializer, [7 x i8] undef, i64 0,
{ [4 x i32], { i8 }, i1 }
{ [4 x i32] zeroinitializer, { i8 } { i8 undef }, i1 false }
}, align 8