Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: test/Transforms/NaCl/expand-tls.ll

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/Transforms/NaCl/expand-struct-regs.ll ('k') | test/Transforms/NaCl/expand-tls-aligned.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 ; RUN: opt < %s -nacl-expand-tls -S | FileCheck %s
2
3 ; All thread-local variables should be removed
4 ; RUN: opt < %s -nacl-expand-tls -S | FileCheck %s -check-prefix=NO_TLS
5
6 ; NO_TLS-NOT: thread_local
7
8 @tvar1 = thread_local global i64 123
9 @tvar2 = thread_local global i32 456
10
11
12 ; CHECK: %tls_init_template = type <{ i64, i32 }>
13 ; CHECK: %tls_struct = type <{ %tls_init_template, %tls_bss_template }>
14 ; CHECK: %tls_bss_template = type <{ [4 x i8] }>
15
16
17 ; CHECK: @__tls_template_start = internal constant %tls_init_template <{ i64 123 , i32 456 }>
18
19 ; CHECK: @__tls_template_alignment = internal constant i32 8
20
21
22 define i64* @get_tvar1() {
23 ret i64* @tvar1
24 }
25 ; CHECK: define i64* @get_tvar1()
26 ; CHECK: %tls_raw = call i8* @llvm.nacl.read.tp()
27 ; CHECK: %tls_struct = bitcast i8* %tls_raw to %tls_struct*
28 ; CHECK: %field = getelementptr %tls_struct* %tls_struct, i32 -1, i32 0, i32 0
29 ; CHECK: ret i64* %field
30
31
32 define i32* @get_tvar2() {
33 ret i32* @tvar2
34 }
35 ; Much the same as for get_tvar1.
36 ; CHECK: define i32* @get_tvar2()
37 ; CHECK: %field = getelementptr %tls_struct* %tls_struct, i32 -1, i32 0, i32 1
38
39
40 ; Check that we define global variables for TLS templates
41
42 @__tls_template_start = external global i8
43 @__tls_template_tdata_end = external global i8
44 @__tls_template_end = external global i8
45
46 define i8* @get_tls_template_start() {
47 ret i8* @__tls_template_start
48 }
49 ; CHECK: define i8* @get_tls_template_start()
50 ; CHECK: ret i8* bitcast (%tls_init_template* @__tls_template_start to i8*)
51
52 define i8* @get_tls_template_tdata_end() {
53 ret i8* @__tls_template_tdata_end
54 }
55 ; CHECK: define i8* @get_tls_template_tdata_end()
56 ; CHECK: ret i8* bitcast (%tls_init_template* getelementptr inbounds (%tls_init_ template* @__tls_template_start, i32 1) to i8*)
57
58 define i8* @get_tls_template_end() {
59 ret i8* @__tls_template_end
60 }
61 ; CHECK: define i8* @get_tls_template_end()
62 ; CHECK: ret i8* bitcast (%tls_struct* getelementptr (%tls_struct* bitcast (%tls _init_template* @__tls_template_start to %tls_struct*), i32 1) to i8*)
63
64
65 ; Check that we define the TLS layout functions
66
67 declare i32 @__nacl_tp_tls_offset(i32)
68 declare i32 @__nacl_tp_tdb_offset(i32)
69
70 define i32 @test_get_tp_tls_offset(i32 %tls_size) {
71 %offset = call i32 @__nacl_tp_tls_offset(i32 %tls_size)
72 ret i32 %offset
73 }
74 ; Uses of the intrinsic are replaced with uses of a regular function.
75 ; CHECK: define i32 @test_get_tp_tls_offset
76 ; CHECK: call i32 @nacl_tp_tls_offset
77 ; NO_TLS-NOT: __nacl_tp_tls_offset
78
79 define i32 @test_get_tp_tdb_offset(i32 %tdb_size) {
80 %offset = call i32 @__nacl_tp_tdb_offset(i32 %tdb_size)
81 ret i32 %offset
82 }
83 ; Uses of the intrinsic are replaced with uses of a regular function.
84 ; CHECK: define i32 @test_get_tp_tdb_offset
85 ; CHECK: call i32 @nacl_tp_tdb_offset
86 ; NO_TLS-NOT: __nacl_tp_tdb_offset
OLDNEW
« no previous file with comments | « test/Transforms/NaCl/expand-struct-regs.ll ('k') | test/Transforms/NaCl/expand-tls-aligned.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698