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

Side by Side Diff: test/Transforms/NaCl/expand-varargs-attrs.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-varargs.ll ('k') | test/Transforms/NaCl/expand-varargs-struct.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 -expand-varargs -S | FileCheck %s
2
3 declare i32 @varargs_func(i32 %arg, ...)
4
5
6 ; Check that attributes such as "byval" are preserved on fixed arguments.
7
8 %MyStruct = type { i64, i64 }
9
10 define void @func_with_arg_attrs(%MyStruct* byval, ...) {
11 ret void
12 }
13 ; CHECK: define void @func_with_arg_attrs(%MyStruct* byval, i8* noalias %varargs ) {
14
15
16 declare void @take_struct_arg(%MyStruct* byval %s, ...)
17
18 define void @call_with_arg_attrs(%MyStruct* %s) {
19 call void (%MyStruct*, ...)* @take_struct_arg(%MyStruct* byval %s)
20 ret void
21 }
22 ; CHECK: define void @call_with_arg_attrs(%MyStruct* %s) {
23 ; CHECK: call void %vararg_func(%MyStruct* byval %s, <{ i32 }>* %vararg_buffer)
24
25
26 ; The "byval" attribute here should be dropped.
27 define i32 @pass_struct_via_vararg1(%MyStruct* %s) {
28 %result = call i32 (i32, ...)* @varargs_func(i32 111, %MyStruct* byval %s)
29 ret i32 %result
30 }
31 ; CHECK: define i32 @pass_struct_via_vararg1(%MyStruct* %s) {
32 ; CHECK: %result = call i32 %vararg_func(i32 111, <{ %MyStruct }>* %vararg_buffe r)
33
34
35 ; The "byval" attribute here should be dropped.
36 define i32 @pass_struct_via_vararg2(%MyStruct* %s) {
37 %result = call i32 (i32, ...)* @varargs_func(i32 111, i32 2, %MyStruct* byval %s)
38 ret i32 %result
39 }
40 ; CHECK: define i32 @pass_struct_via_vararg2(%MyStruct* %s) {
41 ; CHECK: %result = call i32 %vararg_func(i32 111, <{ i32, %MyStruct }>* %vararg_ buffer)
42
43
44 ; Check that return attributes such as "signext" are preserved.
45 define i32 @call_with_return_attr() {
46 %result = call signext i32 (i32, ...)* @varargs_func(i32 111, i64 222)
47 ret i32 %result
48 }
49 ; CHECK: define i32 @call_with_return_attr() {
50 ; CHECK: %result = call signext i32 %vararg_func(i32 111
51
52
53 ; Check that the "readonly" function attribute is preserved.
54 define i32 @call_readonly() {
55 %result = call i32 (i32, ...)* @varargs_func(i32 111, i64 222) readonly
56 ret i32 %result
57 }
58 ; CHECK: define i32 @call_readonly() {
59 ; CHECK: %result = call i32 %vararg_func(i32 111, {{.*}}) #1
60
61
62 ; Check that the "tail" attribute gets removed, because the callee
63 ; reads space alloca'd by the caller.
64 define i32 @tail_call() {
65 %result = tail call i32 (i32, ...)* @varargs_func(i32 111, i64 222)
66 ret i32 %result
67 }
68 ; CHECK: define i32 @tail_call() {
69 ; CHECK: %result = call i32 %vararg_func(i32 111
70
71
72 ; CHECK: attributes #1 = { readonly }
OLDNEW
« no previous file with comments | « test/Transforms/NaCl/expand-varargs.ll ('k') | test/Transforms/NaCl/expand-varargs-struct.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698