2009-09-08 23:54:48 +00:00
|
|
|
; RUN: llc < %s -mtriple=i386-unknown-linux-gnu | FileCheck %s -check-prefix=LINUX
|
|
|
|
; RUN: llc < %s -mtriple=i386-apple-darwin9.7 | FileCheck %s -check-prefix=DARWIN
|
2014-02-13 23:16:11 +00:00
|
|
|
; RUN: llc < %s -mtriple=i386-apple-darwin10 -relocation-model=static | FileCheck %s -check-prefix=DARWIN-STATIC
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s -check-prefix=DARWIN64
|
2015-02-12 17:16:46 +00:00
|
|
|
; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -data-sections -function-sections | FileCheck %s -check-prefix=LINUX-SECTIONS
|
2015-02-26 23:55:11 +00:00
|
|
|
; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -function-sections | FileCheck %s -check-prefix=LINUX-FUNC-SECTIONS
|
2015-02-17 23:34:51 +00:00
|
|
|
; RUN: llc < %s -mtriple=x86_64-pc-linux -data-sections -function-sections -relocation-model=pic | FileCheck %s -check-prefix=LINUX-SECTIONS-PIC
|
2014-05-20 21:25:34 +00:00
|
|
|
; RUN: llc < %s -mtriple=i686-pc-win32 -data-sections -function-sections | FileCheck %s -check-prefix=WIN32-SECTIONS
|
2015-03-11 19:58:37 +00:00
|
|
|
; RUN: llc < %s -mtriple=i686-pc-win32 -function-sections | FileCheck %s -check-prefix=WIN32-FUNC-SECTIONS
|
2009-07-25 17:57:37 +00:00
|
|
|
|
2014-03-25 06:14:26 +00:00
|
|
|
define void @F1() {
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; WIN32-SECTIONS: .section .text,"xr",one_only,_F1
|
|
|
|
; WIN32-SECTIONS: .globl _F1
|
2009-07-26 00:51:36 +00:00
|
|
|
|
2015-02-12 17:16:46 +00:00
|
|
|
define void @F2(i32 %y) {
|
|
|
|
bb0:
|
|
|
|
switch i32 %y, label %bb5 [
|
|
|
|
i32 1, label %bb1
|
|
|
|
i32 2, label %bb2
|
|
|
|
i32 3, label %bb3
|
|
|
|
i32 4, label %bb4
|
|
|
|
]
|
|
|
|
bb1:
|
|
|
|
ret void
|
|
|
|
bb2:
|
|
|
|
ret void
|
|
|
|
bb3:
|
|
|
|
ret void
|
|
|
|
bb4:
|
|
|
|
ret void
|
|
|
|
bb5:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; LINUX: .size F2,
|
|
|
|
; LINUX-NEX: .cfi_endproc
|
|
|
|
; LINUX-NEX: .section .rodata,"a",@progbits
|
|
|
|
|
|
|
|
; LINUX-SECTIONS: .section .text.F2,"ax",@progbits
|
|
|
|
; LINUX-SECTIONS: .size F2,
|
|
|
|
; LINUX-SECTIONS-NEXT: .cfi_endproc
|
|
|
|
; LINUX-SECTIONS-NEXT: .section .rodata.F2,"a",@progbits
|
|
|
|
|
2015-02-26 23:55:11 +00:00
|
|
|
; LINUX-FUNC-SECTIONS: .section .text.F2,"ax",@progbits
|
|
|
|
; LINUX-FUNC-SECTIONS: .size F2,
|
|
|
|
; LINUX-FUNC-SECTIONS-NEXT: .cfi_endproc
|
|
|
|
; LINUX-FUNC-SECTIONS-NEXT: .section .rodata.F2,"a",@progbits
|
|
|
|
|
2015-03-11 19:58:37 +00:00
|
|
|
; WIN32-FUNC-SECTIONS: .section .text,"xr",one_only,_F2
|
|
|
|
; WIN32-FUNC-SECTIONS-NOT: .section
|
|
|
|
; WIN32-FUNC-SECTIONS: .section .rdata,"dr",associative,_F2
|
|
|
|
|
|
|
|
|
2015-02-17 23:34:51 +00:00
|
|
|
; LINUX-SECTIONS-PIC: .section .text.F2,"ax",@progbits
|
|
|
|
; LINUX-SECTIONS-PIC: .size F2,
|
|
|
|
; LINUX-SECTIONS-PIC-NEXT: .cfi_endproc
|
|
|
|
; LINUX-SECTIONS-PIC-NEXT: .section .rodata.F2,"a",@progbits
|
|
|
|
|
2015-02-17 23:21:46 +00:00
|
|
|
declare void @G()
|
|
|
|
|
2015-06-17 20:52:32 +00:00
|
|
|
define void @F3(i32 %y) personality i8* bitcast (void ()* @G to i8*) {
|
2015-02-17 23:21:46 +00:00
|
|
|
bb0:
|
|
|
|
invoke void @G()
|
|
|
|
to label %bb2 unwind label %bb1
|
|
|
|
bb1:
|
2015-06-17 20:52:32 +00:00
|
|
|
landingpad { i8*, i32 }
|
2015-02-17 23:21:46 +00:00
|
|
|
catch i8* null
|
|
|
|
br label %bb2
|
|
|
|
bb2:
|
|
|
|
|
|
|
|
switch i32 %y, label %bb7 [
|
|
|
|
i32 1, label %bb3
|
|
|
|
i32 2, label %bb4
|
|
|
|
i32 3, label %bb5
|
|
|
|
i32 4, label %bb6
|
|
|
|
]
|
|
|
|
bb3:
|
|
|
|
ret void
|
|
|
|
bb4:
|
|
|
|
ret void
|
|
|
|
bb5:
|
|
|
|
ret void
|
|
|
|
bb6:
|
|
|
|
ret void
|
|
|
|
bb7:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; DARWIN64: _F3:
|
2015-03-04 00:27:43 +00:00
|
|
|
; DARWIN64: Lfunc_end
|
2015-02-27 18:18:39 +00:00
|
|
|
; DARWIN64-NEXT: .cfi_endproc
|
2015-02-17 23:21:46 +00:00
|
|
|
; DARWIN64-NOT: .section
|
2016-05-03 21:03:41 +00:00
|
|
|
; DARWIN64: .data_region jt32
|
2015-02-17 23:21:46 +00:00
|
|
|
; DARWIN64: LJTI{{.*}}:
|
2015-03-09 18:29:12 +00:00
|
|
|
; DARWIN64-NEXT: .long
|
|
|
|
; DARWIN64-NEXT: .long
|
|
|
|
; DARWIN64-NEXT: .long
|
|
|
|
; DARWIN64-NEXT: .long
|
2016-05-03 21:03:41 +00:00
|
|
|
; DARWIN64-NEXT: .end_data_region
|
2015-03-09 18:29:12 +00:00
|
|
|
; DARWIN64-NEXT: .section __TEXT,__gcc_except_tab
|
2015-02-17 23:21:46 +00:00
|
|
|
|
2009-07-26 00:51:36 +00:00
|
|
|
; int G1;
|
2009-07-25 17:57:37 +00:00
|
|
|
@G1 = common global i32 0
|
|
|
|
|
|
|
|
; LINUX: .type G1,@object
|
|
|
|
; LINUX: .comm G1,4,4
|
|
|
|
|
2014-05-20 21:25:34 +00:00
|
|
|
; DARWIN: .comm _G1,4,2
|
2009-07-26 00:51:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; const int G2 __attribute__((weak)) = 42;
|
2014-05-20 21:25:34 +00:00
|
|
|
@G2 = weak_odr unnamed_addr constant i32 42
|
2009-07-26 00:51:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
; TODO: linux drops this into .rodata, we drop it into ".gnu.linkonce.r.G2"
|
|
|
|
|
2015-10-15 05:28:38 +00:00
|
|
|
; DARWIN: .section __TEXT,__const{{$}}
|
2009-07-26 00:51:36 +00:00
|
|
|
; DARWIN: _G2:
|
|
|
|
; DARWIN: .long 42
|
2009-07-26 01:24:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
; int * const G3 = &G1;
|
2011-01-16 18:02:57 +00:00
|
|
|
@G3 = unnamed_addr constant i32* @G1
|
2009-07-26 01:24:18 +00:00
|
|
|
|
2009-08-10 01:39:42 +00:00
|
|
|
; DARWIN: .section __DATA,__const
|
2009-07-26 01:24:18 +00:00
|
|
|
; DARWIN: .globl _G3
|
|
|
|
; DARWIN: _G3:
|
|
|
|
; DARWIN: .long _G1
|
|
|
|
|
2011-03-04 20:03:14 +00:00
|
|
|
; LINUX: .section .rodata,"a",@progbits
|
2010-04-13 00:36:43 +00:00
|
|
|
; LINUX: .globl G3
|
|
|
|
|
2011-03-04 20:03:14 +00:00
|
|
|
; LINUX-SECTIONS: .section .rodata.G3,"a",@progbits
|
2010-04-13 00:36:43 +00:00
|
|
|
; LINUX-SECTIONS: .globl G3
|
|
|
|
|
2015-02-07 08:26:40 +00:00
|
|
|
; WIN32-SECTIONS: .section .rdata,"dr",one_only,_G3
|
2014-03-25 06:14:26 +00:00
|
|
|
; WIN32-SECTIONS: .globl _G3
|
|
|
|
|
2009-07-26 01:24:18 +00:00
|
|
|
|
|
|
|
; _Complex long long const G4 = 34;
|
2014-08-28 20:13:31 +00:00
|
|
|
@G4 = private unnamed_addr constant {i64,i64} { i64 34, i64 0 }
|
2009-07-26 01:24:18 +00:00
|
|
|
|
2011-07-19 23:14:32 +00:00
|
|
|
; DARWIN: .section __TEXT,__literal16,16byte_literals
|
2014-08-28 20:13:31 +00:00
|
|
|
; DARWIN: L_G4:
|
2009-07-26 03:06:11 +00:00
|
|
|
; DARWIN: .long 34
|
|
|
|
|
2014-02-13 23:16:11 +00:00
|
|
|
; DARWIN-STATIC: .section __TEXT,__literal16,16byte_literals
|
2014-08-28 20:13:31 +00:00
|
|
|
; DARWIN-STATIC: L_G4:
|
2014-02-13 23:16:11 +00:00
|
|
|
; DARWIN-STATIC: .long 34
|
|
|
|
|
|
|
|
; DARWIN64: .section __TEXT,__literal16,16byte_literals
|
2014-08-28 20:13:31 +00:00
|
|
|
; DARWIN64: L_G4:
|
2014-02-13 23:16:11 +00:00
|
|
|
; DARWIN64: .quad 34
|
|
|
|
|
2009-07-26 03:06:11 +00:00
|
|
|
; int G5 = 47;
|
|
|
|
@G5 = global i32 47
|
|
|
|
|
|
|
|
; LINUX: .data
|
|
|
|
; LINUX: .globl G5
|
|
|
|
; LINUX: G5:
|
|
|
|
; LINUX: .long 47
|
|
|
|
|
2009-08-10 01:39:42 +00:00
|
|
|
; DARWIN: .section __DATA,__data
|
2009-07-26 03:06:11 +00:00
|
|
|
; DARWIN: .globl _G5
|
|
|
|
; DARWIN: _G5:
|
|
|
|
; DARWIN: .long 47
|
|
|
|
|
2009-07-29 05:20:33 +00:00
|
|
|
|
|
|
|
; PR4584
|
|
|
|
@"foo bar" = linkonce global i32 42
|
|
|
|
|
2014-05-20 21:25:34 +00:00
|
|
|
; LINUX: .type "foo bar",@object
|
|
|
|
; LINUX: .weak "foo bar"
|
2013-11-13 14:01:59 +00:00
|
|
|
; LINUX: "foo bar":
|
2009-07-29 05:20:33 +00:00
|
|
|
|
2014-05-20 21:25:34 +00:00
|
|
|
; DARWIN: .globl "_foo bar"
|
|
|
|
; DARWIN: .weak_definition "_foo bar"
|
2009-07-29 05:20:33 +00:00
|
|
|
; DARWIN: "_foo bar":
|
2009-07-31 16:17:13 +00:00
|
|
|
|
|
|
|
; PR4650
|
2011-01-16 18:02:57 +00:00
|
|
|
@G6 = weak_odr unnamed_addr constant [1 x i8] c"\01"
|
2009-07-31 16:17:13 +00:00
|
|
|
|
2014-05-20 21:25:34 +00:00
|
|
|
; LINUX: .type G6,@object
|
|
|
|
; LINUX: .weak G6
|
2009-08-13 01:36:44 +00:00
|
|
|
; LINUX: G6:
|
2014-05-20 21:25:34 +00:00
|
|
|
; LINUX: .byte 1
|
|
|
|
; LINUX: .size G6, 1
|
2009-07-31 16:17:13 +00:00
|
|
|
|
2015-10-15 05:28:38 +00:00
|
|
|
; DARWIN: .section __TEXT,__const{{$}}
|
2009-07-31 16:17:13 +00:00
|
|
|
; DARWIN: .globl _G6
|
|
|
|
; DARWIN: .weak_definition _G6
|
|
|
|
; DARWIN:_G6:
|
2010-01-23 04:54:10 +00:00
|
|
|
; DARWIN: .byte 1
|
2009-07-31 16:17:13 +00:00
|
|
|
|
2009-08-04 16:13:09 +00:00
|
|
|
|
2011-01-16 18:02:57 +00:00
|
|
|
@G7 = unnamed_addr constant [10 x i8] c"abcdefghi\00"
|
2009-08-04 16:13:09 +00:00
|
|
|
|
2014-05-20 21:25:34 +00:00
|
|
|
; DARWIN: __TEXT,__cstring,cstring_literals
|
|
|
|
; DARWIN: .globl _G7
|
2009-08-04 16:13:09 +00:00
|
|
|
; DARWIN: _G7:
|
2014-05-20 21:25:34 +00:00
|
|
|
; DARWIN: .asciz "abcdefghi"
|
2009-08-04 16:13:09 +00:00
|
|
|
|
2014-05-20 21:25:34 +00:00
|
|
|
; LINUX: .section .rodata.str1.1,"aMS",@progbits,1
|
|
|
|
; LINUX: .globl G7
|
2009-08-04 16:13:09 +00:00
|
|
|
; LINUX: G7:
|
2014-05-20 21:25:34 +00:00
|
|
|
; LINUX: .asciz "abcdefghi"
|
2009-08-04 16:13:09 +00:00
|
|
|
|
Don't create multiple mergeable sections with -fdata-sections.
ELF has support for sections that can be split into fixed size or
null terminated entities.
Since these sections can be split by the linker, it is not necessary
to split them in codegen.
This reduces the combined .o size in a llvm+clang build from
202,394,570 to 173,819,098 bytes.
The time for linking clang with gold (on a VM, on a laptop) goes
from 2.250089985 to 1.383001792 seconds.
The flip side is the size of rodata in clang goes from 10,926,785
to 10,929,345 bytes.
The increase seems to be because of http://sourceware.org/bugzilla/show_bug.cgi?id=17902.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227431 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-29 12:43:28 +00:00
|
|
|
; LINUX-SECTIONS: .section .rodata.str1.1,"aMS",@progbits,1
|
2014-05-20 21:25:34 +00:00
|
|
|
; LINUX-SECTIONS: .globl G7
|
2010-04-13 00:36:43 +00:00
|
|
|
|
2015-02-07 08:26:40 +00:00
|
|
|
; WIN32-SECTIONS: .section .rdata,"dr",one_only,_G7
|
2014-05-20 21:25:34 +00:00
|
|
|
; WIN32-SECTIONS: .globl _G7
|
2014-03-25 06:14:26 +00:00
|
|
|
|
2009-08-04 16:13:09 +00:00
|
|
|
|
2011-01-16 18:02:57 +00:00
|
|
|
@G8 = unnamed_addr constant [4 x i16] [ i16 1, i16 2, i16 3, i16 0 ]
|
2009-08-04 16:13:09 +00:00
|
|
|
|
2014-05-20 21:25:34 +00:00
|
|
|
; DARWIN: .section __TEXT,__const
|
|
|
|
; DARWIN: .globl _G8
|
2009-08-04 16:13:09 +00:00
|
|
|
; DARWIN: _G8:
|
|
|
|
|
2014-05-20 21:25:34 +00:00
|
|
|
; LINUX: .section .rodata.str2.2,"aMS",@progbits,2
|
|
|
|
; LINUX: .globl G8
|
2009-08-04 16:13:09 +00:00
|
|
|
; LINUX:G8:
|
|
|
|
|
2011-01-16 18:02:57 +00:00
|
|
|
@G9 = unnamed_addr constant [4 x i32] [ i32 1, i32 2, i32 3, i32 0 ]
|
2009-08-04 16:13:09 +00:00
|
|
|
|
2014-05-20 21:25:34 +00:00
|
|
|
; DARWIN: .globl _G9
|
2009-08-04 16:13:09 +00:00
|
|
|
; DARWIN: _G9:
|
|
|
|
|
2014-05-20 21:25:34 +00:00
|
|
|
; LINUX: .section .rodata.str4.4,"aMS",@progbits,4
|
|
|
|
; LINUX: .globl G9
|
2009-08-04 16:13:09 +00:00
|
|
|
; LINUX:G9
|
|
|
|
|
|
|
|
|
2010-01-19 03:06:01 +00:00
|
|
|
@G10 = weak global [100 x i32] zeroinitializer, align 32 ; <[100 x i32]*> [#uses=0]
|
|
|
|
|
|
|
|
|
2015-10-15 05:28:38 +00:00
|
|
|
; DARWIN: .section __DATA,__data{{$}}
|
2010-01-19 03:06:01 +00:00
|
|
|
; DARWIN: .globl _G10
|
2014-05-20 21:25:34 +00:00
|
|
|
; DARWIN: .weak_definition _G10
|
2016-01-26 00:03:25 +00:00
|
|
|
; DARWIN: .p2align 5
|
2010-01-19 03:06:01 +00:00
|
|
|
; DARWIN: _G10:
|
2014-05-20 21:25:34 +00:00
|
|
|
; DARWIN: .space 400
|
2010-01-19 03:06:01 +00:00
|
|
|
|
2014-05-20 21:25:34 +00:00
|
|
|
; LINUX: .bss
|
|
|
|
; LINUX: .weak G10
|
2016-01-26 00:03:25 +00:00
|
|
|
; LINUX: .p2align 5
|
2010-01-19 03:06:01 +00:00
|
|
|
; LINUX: G10:
|
2014-05-20 21:25:34 +00:00
|
|
|
; LINUX: .zero 400
|
2009-08-04 16:13:09 +00:00
|
|
|
|
2010-04-27 07:41:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
;; Zero sized objects should round up to 1 byte in zerofill directives.
|
|
|
|
; rdar://7886017
|
|
|
|
@G11 = global [0 x i32] zeroinitializer
|
|
|
|
@G12 = global {} zeroinitializer
|
|
|
|
@G13 = global { [0 x {}] } zeroinitializer
|
|
|
|
|
|
|
|
; DARWIN: .globl _G11
|
|
|
|
; DARWIN: .zerofill __DATA,__common,_G11,1,2
|
|
|
|
; DARWIN: .globl _G12
|
|
|
|
; DARWIN: .zerofill __DATA,__common,_G12,1,3
|
|
|
|
; DARWIN: .globl _G13
|
|
|
|
; DARWIN: .zerofill __DATA,__common,_G13,1,3
|
2014-02-19 17:23:20 +00:00
|
|
|
|
|
|
|
@G14 = private unnamed_addr constant [4 x i8] c"foo\00", align 1
|
|
|
|
|
|
|
|
; LINUX-SECTIONS: .type .LG14,@object # @G14
|
Don't create multiple mergeable sections with -fdata-sections.
ELF has support for sections that can be split into fixed size or
null terminated entities.
Since these sections can be split by the linker, it is not necessary
to split them in codegen.
This reduces the combined .o size in a llvm+clang build from
202,394,570 to 173,819,098 bytes.
The time for linking clang with gold (on a VM, on a laptop) goes
from 2.250089985 to 1.383001792 seconds.
The flip side is the size of rodata in clang goes from 10,926,785
to 10,929,345 bytes.
The increase seems to be because of http://sourceware.org/bugzilla/show_bug.cgi?id=17902.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227431 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-29 12:43:28 +00:00
|
|
|
; LINUX-SECTIONS: .section .rodata.str1.1,"aMS",@progbits,1
|
2014-02-19 17:23:20 +00:00
|
|
|
; LINUX-SECTIONS: .LG14:
|
|
|
|
; LINUX-SECTIONS: .asciz "foo"
|
|
|
|
; LINUX-SECTIONS: .size .LG14, 4
|
2014-03-23 17:47:39 +00:00
|
|
|
|
2015-03-17 23:54:51 +00:00
|
|
|
; WIN32-SECTIONS: .section .rdata,"dr",one_only,_G14
|
|
|
|
; WIN32-SECTIONS: _G14:
|
2014-03-25 06:14:26 +00:00
|
|
|
; WIN32-SECTIONS: .asciz "foo"
|
2014-03-23 17:47:39 +00:00
|
|
|
|
2014-08-28 20:13:31 +00:00
|
|
|
; cannot be merged on MachO, but can on other formats.
|
|
|
|
@G15 = unnamed_addr constant i64 0
|
|
|
|
|
|
|
|
; LINUX: .section .rodata.cst8,"aM",@progbits,8
|
|
|
|
; LINUX: G15:
|
|
|
|
|
|
|
|
; DARWIN: .section __TEXT,__const
|
|
|
|
; DARWIN: _G15:
|
|
|
|
|
|
|
|
; DARWIN-STATIC: .section __TEXT,__const
|
|
|
|
; DARWIN-STATIC: _G15:
|
|
|
|
|
|
|
|
; DARWIN64: .section __TEXT,__const
|
|
|
|
; DARWIN64: _G15:
|
|
|
|
|
Don't create multiple mergeable sections with -fdata-sections.
ELF has support for sections that can be split into fixed size or
null terminated entities.
Since these sections can be split by the linker, it is not necessary
to split them in codegen.
This reduces the combined .o size in a llvm+clang build from
202,394,570 to 173,819,098 bytes.
The time for linking clang with gold (on a VM, on a laptop) goes
from 2.250089985 to 1.383001792 seconds.
The flip side is the size of rodata in clang goes from 10,926,785
to 10,929,345 bytes.
The increase seems to be because of http://sourceware.org/bugzilla/show_bug.cgi?id=17902.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227431 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-29 12:43:28 +00:00
|
|
|
; LINUX-SECTIONS: .section .rodata.cst8,"aM",@progbits,8
|
2014-08-28 20:13:31 +00:00
|
|
|
; LINUX-SECTIONS: G15:
|
|
|
|
|
2015-02-07 08:26:40 +00:00
|
|
|
; WIN32-SECTIONS: .section .rdata,"dr",one_only,_G15
|
2014-08-28 20:13:31 +00:00
|
|
|
; WIN32-SECTIONS: _G15:
|
2016-02-22 22:23:11 +00:00
|
|
|
|
|
|
|
@G16 = unnamed_addr constant i256 0
|
|
|
|
|
|
|
|
; LINUX: .section .rodata.cst32,"aM",@progbits,32
|
|
|
|
; LINUX: G16:
|
|
|
|
|
|
|
|
; LINUX-SECTIONS: .section .rodata.cst32,"aM",@progbits,32
|
|
|
|
; LINUX-SECTIONS: G16:
|
|
|
|
|
|
|
|
; WIN32-SECTIONS: .section .rdata,"dr",one_only,_G16
|
|
|
|
; WIN32-SECTIONS: _G16:
|