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

Side by Side Diff: test/Transforms/NaCl/flatten-globals.ll

Issue 1694663002: PNaCl dynamic linking: Fix handling of local relocations with addends (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm@master
Patch Set: Created 4 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/convert-to-pso.ll ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ; RUN: opt -flatten-globals %s -S | FileCheck %s 1 ; RUN: opt -flatten-globals %s -S | FileCheck %s
2 ; RUN: opt -flatten-globals %s -S | FileCheck %s -check-prefix=CLEANED 2 ; RUN: opt -flatten-globals %s -S | FileCheck %s -check-prefix=CLEANED
3 3
4 ; Check that the pass can handle its own output (idempotence).
5 ; RUN: opt -flatten-globals -flatten-globals %s -S
6
4 target datalayout = "p:32:32:32" 7 target datalayout = "p:32:32:32"
5 8
6 9
7 ; Check simple cases 10 ; Check simple cases
8 11
9 @var_i32 = global i32 258 12 @var_i32 = global i32 258
10 ; CHECK: @var_i32 = global [4 x i8] c"\02\01\00\00" 13 ; CHECK: @var_i32 = global [4 x i8] c"\02\01\00\00"
11 ; CLEANED-NOT: global i32 258 14 ; CLEANED-NOT: global i32 258
12 15
13 @external_var = external global i32 16 @external_var = external global i32
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 i8* bitcast (void ()* @func_with_block to i8*), i32 123) 183 i8* bitcast (void ()* @func_with_block to i8*), i32 123)
181 ; CHECK: @func_addend = global i32 add (i32 ptrtoint (void ()* @func_with_block to i32), i32 123) 184 ; CHECK: @func_addend = global i32 add (i32 ptrtoint (void ()* @func_with_block to i32), i32 123)
182 185
183 ; Similarly, adding an offset to a label address isn't useful, but 186 ; Similarly, adding an offset to a label address isn't useful, but
184 ; check it anyway. 187 ; check it anyway.
185 @block_addend = global i8* getelementptr ( 188 @block_addend = global i8* getelementptr (
186 i8, 189 i8,
187 i8* blockaddress(@func_with_block, %label), i32 100) 190 i8* blockaddress(@func_with_block, %label), i32 100)
188 ; CHECK: @block_addend = global i32 add (i32 ptrtoint (i8* blockaddress(@func_wi th_block, %label) to i32), i32 100) 191 ; CHECK: @block_addend = global i32 add (i32 ptrtoint (i8* blockaddress(@func_wi th_block, %label) to i32), i32 100)
189 192
193 @add_expr = global i32 add (i32 ptrtoint (%ptrs1* @ptrs1 to i32), i32 8)
194 ; CHECK: @add_expr = global i32 add (i32 ptrtoint (<{ i32, [8 x i8] }>* @ptrs1 t o i32), i32 8)
195
190 196
191 ; Special cases 197 ; Special cases
192 198
193 ; Leave vars with "appending" linkage alone. 199 ; Leave vars with "appending" linkage alone.
194 @appending = appending global [1 x i32*] [i32* @var1] 200 @appending = appending global [1 x i32*] [i32* @var1]
195 ; CHECK: @appending = appending global [1 x i32*] [i32* bitcast ([4 x i8]* @var1 to i32*)] 201 ; CHECK: @appending = appending global [1 x i32*] [i32* bitcast ([4 x i8]* @var1 to i32*)]
196 202
197 203
198 define i32* @get_address() { 204 define i32* @get_address() {
199 ret i32* @var_i32 205 ret i32* @var_i32
200 } 206 }
201 ; CHECK: define i32* @get_address() { 207 ; CHECK: define i32* @get_address() {
202 ; CHECK-NEXT: ret i32* bitcast ([4 x i8]* @var_i32 to i32*) 208 ; CHECK-NEXT: ret i32* bitcast ([4 x i8]* @var_i32 to i32*)
203 209
204 210
205 define void @func_with_block() { 211 define void @func_with_block() {
206 br label %label 212 br label %label
207 label: 213 label:
208 ret void 214 ret void
209 } 215 }
OLDNEW
« no previous file with comments | « test/Transforms/NaCl/convert-to-pso.ll ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698